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
@ -14,6 +14,7 @@ Yii Framework 2 Change Log
|
||||
- Bug #11404: `yii\base\Model::loadMultiple()` returns true even if `yii\base\Model::load()` returns false (zvook)
|
||||
- Bug #13513: Fixed RBAC migration to work correctly on Oracle DBMS (silverfire)
|
||||
- Enh #13550: Refactored unset call order in `yii\di\ServiceLocator::set()` (Lanrik)
|
||||
- Bug #13582: PK column in `yii\db\pgsql\resetSequence()` was not quoted properly (boboldehampsink)
|
||||
- Bug #13592: Fixes Oracle’s `yii\db\oci\Schema::setTransactionIsolationLevel()` (sergeymakinen)
|
||||
- Bug #13594: Fixes insufficient quoting in `yii\db\QueryBuilder::prepareInsertSelectSubQuery()` (sergeymakinen)
|
||||
- Enh #13576: Added support of `srcset` to `yii\helpers\Html::img()` (Kolyunya)
|
||||
|
@ -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