yiisoft/yii2 · error · yii\base\NotSupportedException
CUBRID does not support default value constraints.
Error message
CUBRID does not support default value constraints.
What it means
yii\db\cubrid\Schema::loadTableDefaultValues() (framework/db/cubrid/Schema.php:241) is the loader behind Schema::getTableDefaultValues() and throws NotSupportedException unconditionally because Yii's CUBRID driver does not read default-value constraints from the catalog. Like loadTableChecks() above it, this fires from schema introspection rather than from DDL you wrote yourself.
Source
Thrown at framework/db/cubrid/Schema.php:241
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
}
/**
* Creates a query builder for the CUBRID database.
* @return QueryBuilder query builder instance
*/
public function createQueryBuilder()
{
return Yii::createObject(QueryBuilder::className(), [$this->db]);
}View on GitHub (pinned to 66f00d18a2)
Solutions
- Skip default-value introspection when the driver is cubrid
- Catch yii\db\NotSupportedException and degrade to an empty list
- Read defaults from getTableSchema()->columns[x]->defaultValue instead, which the CUBRID driver does support
Example fix
// before
$defaults = $db->schema->getTableDefaultValues('product'); // throws on CUBRID
// after
try {
$defaults = $db->schema->getTableDefaultValues('product');
} catch (\yii\db\NotSupportedException $e) {
$defaults = []; // not supported by the CUBRID driver
} Defensive patterns
Strategy: try-catch
Validate before calling
$defaults = [];
if ($db->driverName !== 'cubrid') {
$defaults = $db->schema->getTableDefaultValues($tableName);
} else {
// column-level defaults are still available:
foreach ($db->getTableSchema($tableName)->columns as $name => $column) {
$defaults[$name] = $column->defaultValue;
}
} Try / catch
try {
$defaults = $db->schema->getTableDefaultValues($tableName);
} catch (\yii\db\NotSupportedException $e) {
$defaults = []; // fall back to TableSchema->columns[x]->defaultValue
} Prevention
- Use TableSchema->columns[x]->defaultValue for portable default-value introspection
- Skip constraint-type loaders the driver declares unsupported
- Feature-detect per driver in shared introspection code
When it happens
Trigger: $db->schema->getTableDefaultValues('product'); tooling iterating all constraint types (checks/uniques/defaults); schema diffing or ER-diagram generation against CUBRID.
Common situations: Cross-DBMS introspection utilities; model/code generators enumerating constraints; QA tooling that validates schema expectations on every supported driver.
Related errors
- CUBRID does not support check constraints.
- SQLite does not support default value constraints.
- Table not found: $tableName
- There is not sequence associated with table '$tableName'.
- yii\db\cubrid\QueryBuilder::addCheck is not supported by CUB
AI-assisted analysis of yiisoft/yii2@66f00d18a2 (2026-08-17).
Data as JSON: /api/errors/9c8aba704f505518.
Report an issue: GitHub.