yiisoft/yii2 · error · yii\base\NotSupportedException

CUBRID does not support check constraints.

Error message

CUBRID does not support check constraints.

What it means

yii\db\cubrid\Schema::loadTableChecks() (framework/db/cubrid/Schema.php:232) is the metadata loader behind Schema::getTableChecks() and throws NotSupportedException unconditionally — Yii's CUBRID driver cannot read CHECK constraints from the catalog. Any code introspecting check constraints, including tools that iterate all constraint kinds (uniques, checks, defaults), aborts with 'CUBRID does not support check constraints'.

Source

Thrown at framework/db/cubrid/Schema.php:232

    {
        return $this->loadTableConstraints($tableName, 'indexes');
    }

    /**
     * {@inheritdoc}
     */
    protected function loadTableUniques($tableName)
    {
        return $this->loadTableConstraints($tableName, 'uniques');
    }

    /**
     * {@inheritdoc}
     * @throws NotSupportedException if this method is called.
     */
    protected function loadTableChecks($tableName)
    {
        throw new NotSupportedException('CUBRID does not support check constraints.');
    }

    /**
     * {@inheritdoc}
     * @throws NotSupportedException if this method is called.
     */
    protected function loadTableDefaultValues($tableName)
    {
        throw new NotSupportedException('CUBRID does not support default value constraints.');
    }

    /**
     * {@inheritdoc}
     */
    public function releaseSavepoint($name)
    {
        // does nothing as cubrid does not support this
    }

View on GitHub (pinned to 66f00d18a2)

Solutions

  1. Skip check-constraint introspection when $db->driverName === 'cubrid' (or getDriverName() of the schema)
  2. Catch yii\db\NotSupportedException and treat the check list as empty
  3. If needed, query CUBRID's catalog directly with raw SQL via createCommand()

Example fix

// before
$checks = $db->schema->getTableChecks('product'); // throws on CUBRID

// after
try {
    $checks = $db->schema->getTableChecks('product');
} catch (\yii\db\NotSupportedException $e) {
    $checks = []; // CUBRID driver cannot load check constraints
}
Defensive patterns

Strategy: try-catch

Validate before calling

$checks = [];
if ($db->driverName !== 'cubrid') {
    $checks = $db->schema->getTableChecks($tableName);
}

Try / catch

try {
    $checks = $db->schema->getTableChecks($tableName);
} catch (\yii\db\NotSupportedException $e) {
    $checks = []; // CUBRID driver cannot load check constraints
}

Prevention

When it happens

Trigger: $db->schema->getTableChecks('product'); introspection or model-generation tooling that loops over constraint types; generic schema-diff/reporting utilities run against CUBRID.

Common situations: Schema-introspection utilities originally written for MySQL/PostgreSQL deployed on CUBRID; code generators (Gii-like tooling) enumerating constraints; multi-DBMS products with a single introspection path.

Related errors


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