mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
Fixes #13582: PK column in yii\db\pgsql\resetSequence()
was not quoted properly
This commit is contained in:

committed by
Alexander Makarov

parent
323568c2e9
commit
aeb6231d92
@ -164,8 +164,8 @@ class QueryBuilder extends \yii\db\QueryBuilder
|
||||
$sequence = $this->db->quoteTableName($table->sequenceName);
|
||||
$tableName = $this->db->quoteTableName($tableName);
|
||||
if ($value === null) {
|
||||
$key = reset($table->primaryKey);
|
||||
$value = "(SELECT COALESCE(MAX(\"{$key}\"),0) FROM {$tableName})+1";
|
||||
$key = $this->db->quoteColumnName(reset($table->primaryKey));
|
||||
$value = "(SELECT COALESCE(MAX({$key}),0) FROM {$tableName})+1";
|
||||
} else {
|
||||
$value = (int) $value;
|
||||
}
|
||||
|
Reference in New Issue
Block a user