{"record":{"id":"5b775b3b17d46dde","repo":"laravel/framework","slug":"this-database-engine-does-not-support-the-updatefr","errorCode":null,"errorMessage":"This database engine does not support the updateFrom method.","messagePattern":"This database engine does not support the updateFrom method\\.","errorType":"exception","errorClass":"LogicException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Database/Query/Builder.php","lineNumber":4336,"sourceCode":"\n        $sql = $this->grammar->compileUpdate($this, $values->map(fn ($value) => $value['value'])->all());\n\n        return $this->connection->update($sql, $this->cleanBindings(\n            $this->grammar->prepareBindingsForUpdate($this->bindings, $values->map(fn ($value) => $value['bindings'])->all())\n        ));\n    }\n\n    /**\n     * Update records in a PostgreSQL database using the update from syntax.\n     *\n     * @return int\n     *\n     * @throws \\LogicException\n     */\n    public function updateFrom(array $values)\n    {\n        if (! method_exists($this->grammar, 'compileUpdateFrom')) {\n            throw new LogicException('This database engine does not support the updateFrom method.');\n        }\n\n        $this->applyBeforeQueryCallbacks();\n\n        $sql = $this->grammar->compileUpdateFrom($this, $values);\n\n        return $this->connection->update($sql, $this->cleanBindings(\n            $this->grammar->prepareBindingsForUpdateFrom($this->bindings, $values)\n        ));\n    }\n\n    /**\n     * Insert or update a record matching the attributes, and fill it with values.\n     *\n     * @return bool\n     */\n    public function updateOrInsert(array $attributes, array|callable $values = [])\n    {","sourceCodeStart":4318,"sourceCodeEnd":4354,"githubUrl":"https://github.com/laravel/framework/blob/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Database/Query/Builder.php#L4318-L4354","documentation":"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.","triggerScenarios":"Calling ->updateFrom($values) on a query backed by a MySQL, SQLite, or SQL Server connection.","commonSituations":"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.","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()."],"exampleFix":"// before (default mysql connection)\n->updateFrom(['col' => $val]);\n\n// after\nDB::connection('pgsql')->table('t')->updateFrom(['col' => $val]);","handlingStrategy":"validation","validationCode":"if (! method_exists($query->getGrammar(), 'compileUpdateFrom')) {\n    throw new RuntimeException('updateFrom requires a PostgreSQL connection.');\n}\n$query->updateFrom($values);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["query-builder","update-from","postgresql","database-driver"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}