{"record":{"id":"3e4795924cbb8d2d","repo":"yiisoft/yii2","slug":"does-not-support-upsert-statements","errorCode":null,"errorMessage":"{} does not support upsert statements.","messagePattern":"(.+?) does not support upsert statements\\.","errorType":"exception","errorClass":"yii\\base\\NotSupportedException","httpStatus":null,"severity":"error","filePath":"framework/db/QueryBuilder.php","lineNumber":536,"sourceCode":"     * ```\n     *\n     * The method will properly escape the table and column names.\n     *\n     * @param string $table the table that new rows will be inserted into/updated in.\n     * @param array|Query $insertColumns the column data (name => value) to be inserted into the table or instance\n     * of [[Query]] to perform `INSERT INTO ... SELECT` SQL statement.\n     * @param array|bool $updateColumns the column data (name => value) to be updated if they already exist.\n     * If `true` is passed, the column data will be updated to match the insert column data.\n     * If `false` is passed, no update will be performed if the column data already exists.\n     * @param array $params the binding parameters that will be generated by this method.\n     * They should be bound to the DB command later.\n     * @return string the resulting SQL.\n     * @throws NotSupportedException if this is not supported by the underlying DBMS.\n     * @since 2.0.14\n     */\n    public function upsert($table, $insertColumns, $updateColumns, &$params)\n    {\n        throw new NotSupportedException($this->db->getDriverName() . ' does not support upsert statements.');\n    }\n\n    /**\n     * @param string $table\n     * @param array|Query $insertColumns\n     * @param array|bool $updateColumns\n     * @param Constraint[] $constraints this parameter recieves a matched constraint list.\n     * The constraints will be unique by their column names.\n     * @return array\n     * @since 2.0.14\n     */\n    protected function prepareUpsertColumns($table, $insertColumns, $updateColumns, &$constraints = [])\n    {\n        if ($insertColumns instanceof Query) {\n            list($insertNames) = $this->prepareInsertSelectSubQuery($insertColumns, $this->db->getSchema());\n        } else {\n            $insertNames = array_map([$this->db, 'quoteColumnName'], array_keys($insertColumns));\n        }","sourceCodeStart":518,"sourceCodeEnd":554,"githubUrl":"https://github.com/yiisoft/yii2/blob/66f00d18a29b520f85e8e8f1e32d1e7e7b556cac/framework/db/QueryBuilder.php#L518-L554","documentation":"Error \"{} does not support upsert statements.\" thrown in yiisoft/yii2.","triggerScenarios":"Thrown at framework/db/QueryBuilder.php:536 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"66f00d18a29b520f85e8e8f1e32d1e7e7b556cac","analyzedAt":"2026-08-17T05:17:23.470Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}