laravel/framework · error · LogicException
This database engine does not support the updateFrom method.
Error message
This database engine does not support the updateFrom method.
What it means
updateFrom() emits the PostgreSQL-specific UPDATE ... FROM syntax. It first checks whether the connection's grammar implements compileUpdateFrom; only PostgresGrammar does. On MySQL/SQLite/SQL Server the method is unsupported and throws LogicException to prevent generating invalid SQL.
Solutions
- Switch the connection to pgsql (config('database.default') / DB::connection('pgsql')).
- Branch on driver and use the native idiom (e.g. ->join()->update() for MySQL, or upsert).
- In tests, use a Postgres-compatible driver instead of SQLite if the code path requires updateFrom().
Example fix
// before (default mysql connection)
->updateFrom(['col' => $val]);
// after
DB::connection('pgsql')->table('t')->updateFrom(['col' => $val]); Defensive patterns
Strategy: validation
Validate before calling
if (! method_exists($query->getGrammar(), 'compileUpdateFrom')) {
throw new RuntimeException('updateFrom requires a PostgreSQL connection.');
}
$query->updateFrom($values); Prevention
- Branch query logic on DB::connection()->getDriverName() in multi-DB apps.
- Keep CI on the same driver family as production (Postgres here).
- Encapsulate driver-specific SQL behind a repository method.
When it happens
Trigger: Calling ->updateFrom($values) on a query backed by a MySQL, SQLite, or SQL Server connection.
Common situations: Running code originally written for Postgres against a different default connection; CI using SQLite while production uses Postgres; multi-database apps that did not branch on driver.
Related errors
- The returning columns must not be empty.
- The unique columns must not be empty.
- A subquery must be a query builder instance, a Closure, or…
- Collection given to whereAttachedTo method may not be empty.
- Collection given to whereBelongsTo method may not be empty.
AI-assisted analysis of laravel/framework@e0f6eb3518 (2026-08-11).
Data as JSON: /api/errors/5b775b3b17d46dde.
Report an issue: GitHub.
Appendix: source
Thrown at src/Illuminate/Database/Query/Builder.php:4336
$sql = $this->grammar->compileUpdate($this, $values->map(fn ($value) => $value['value'])->all());
return $this->connection->update($sql, $this->cleanBindings(
$this->grammar->prepareBindingsForUpdate($this->bindings, $values->map(fn ($value) => $value['bindings'])->all())
));
}
/**
* Update records in a PostgreSQL database using the update from syntax.
*
* @return int
*
* @throws \LogicException
*/
public function updateFrom(array $values)
{
if (! method_exists($this->grammar, 'compileUpdateFrom')) {
throw new LogicException('This database engine does not support the updateFrom method.');
}
$this->applyBeforeQueryCallbacks();
$sql = $this->grammar->compileUpdateFrom($this, $values);
return $this->connection->update($sql, $this->cleanBindings(
$this->grammar->prepareBindingsForUpdateFrom($this->bindings, $values)
));
}
/**
* Insert or update a record matching the attributes, and fill it with values.
*
* @return bool
*/
public function updateOrInsert(array $attributes, array|callable $values = [])
{View on GitHub (pinned to e0f6eb3518)