yiisoft/yii2 · error · yii\base\NotSupportedException

{} does not support upsert statements.

Error message

{} does not support upsert statements.

What it means

Error "{} does not support upsert statements." thrown in yiisoft/yii2.

Source

Thrown at framework/db/QueryBuilder.php:536

     * ```
     *
     * The method will properly escape the table and column names.
     *
     * @param string $table the table that new rows will be inserted into/updated in.
     * @param array|Query $insertColumns the column data (name => value) to be inserted into the table or instance
     * of [[Query]] to perform `INSERT INTO ... SELECT` SQL statement.
     * @param array|bool $updateColumns the column data (name => value) to be updated if they already exist.
     * If `true` is passed, the column data will be updated to match the insert column data.
     * If `false` is passed, no update will be performed if the column data already exists.
     * @param array $params the binding parameters that will be generated by this method.
     * They should be bound to the DB command later.
     * @return string the resulting SQL.
     * @throws NotSupportedException if this is not supported by the underlying DBMS.
     * @since 2.0.14
     */
    public function upsert($table, $insertColumns, $updateColumns, &$params)
    {
        throw new NotSupportedException($this->db->getDriverName() . ' does not support upsert statements.');
    }

    /**
     * @param string $table
     * @param array|Query $insertColumns
     * @param array|bool $updateColumns
     * @param Constraint[] $constraints this parameter recieves a matched constraint list.
     * The constraints will be unique by their column names.
     * @return array
     * @since 2.0.14
     */
    protected function prepareUpsertColumns($table, $insertColumns, $updateColumns, &$constraints = [])
    {
        if ($insertColumns instanceof Query) {
            list($insertNames) = $this->prepareInsertSelectSubQuery($insertColumns, $this->db->getSchema());
        } else {
            $insertNames = array_map([$this->db, 'quoteColumnName'], array_keys($insertColumns));
        }

View on GitHub (pinned to 66f00d18a2)

When it happens

Trigger: Thrown at framework/db/QueryBuilder.php:536 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of yiisoft/yii2@66f00d18a2 (2026-08-17). Data as JSON: /api/errors/3e4795924cbb8d2d. Report an issue: GitHub.