Commit 038d5a53 by Qiang Xue

Fixes #4232: `TableSchema::sequenceName` for PostgreSQL should remove the enclosing quotes

parent d62f7beb
...@@ -247,6 +247,7 @@ Yii Framework 2 Change Log ...@@ -247,6 +247,7 @@ Yii Framework 2 Change Log
- Bug #3052: Fixed the issue that cache dependency data is not reused when `reusable` is set true (qiangxue) - Bug #3052: Fixed the issue that cache dependency data is not reused when `reusable` is set true (qiangxue)
- Bug #3691: Fixed the issue that `CookieCollection::has` always returns false for cookies from browser (sonicgd) - Bug #3691: Fixed the issue that `CookieCollection::has` always returns false for cookies from browser (sonicgd)
- Bug #4212: MSSQL query builder should not generate the `ORDER BY` clause when it is not needed (qiangxue) - Bug #4212: MSSQL query builder should not generate the `ORDER BY` clause when it is not needed (qiangxue)
- Bug #4232: `TableSchema::sequenceName` for PostgreSQL should remove the enclosing quotes (katzz0, qiangxue)
- Bug: Fixed `Call to a member function registerAssetFiles() on a non-object` in case of wrong `sourcePath` for an asset bundle (samdark) - Bug: Fixed `Call to a member function registerAssetFiles() on a non-object` in case of wrong `sourcePath` for an asset bundle (samdark)
- Bug: Fixed incorrect event name for `yii\jui\Spinner` (samdark) - Bug: Fixed incorrect event name for `yii\jui\Spinner` (samdark)
- Bug: Json::encode() did not handle objects that implement JsonSerializable interface correctly (cebe) - Bug: Json::encode() did not handle objects that implement JsonSerializable interface correctly (cebe)
......
...@@ -405,7 +405,7 @@ SQL; ...@@ -405,7 +405,7 @@ SQL;
if ($column->isPrimaryKey) { if ($column->isPrimaryKey) {
$table->primaryKey[] = $column->name; $table->primaryKey[] = $column->name;
if ($table->sequenceName === null && preg_match("/nextval\\('\"?\\w+\"?\.?\"?\\w+\"?'(::regclass)?\\)/", $column->defaultValue) === 1) { if ($table->sequenceName === null && preg_match("/nextval\\('\"?\\w+\"?\.?\"?\\w+\"?'(::regclass)?\\)/", $column->defaultValue) === 1) {
$table->sequenceName = preg_replace(['/nextval/', '/::/', '/regclass/', '/\'\)/', '/\(\'/'], '', $column->defaultValue); $table->sequenceName = trim(preg_replace(['/nextval/', '/::/', '/regclass/', '/\'\)/', '/\(\'/'], '', $column->defaultValue), '"');
} }
$column->defaultValue = null; $column->defaultValue = null;
} elseif ($column->defaultValue) { } elseif ($column->defaultValue) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment