diff --git a/docs/guide-es/db-dao.md b/docs/guide-es/db-dao.md index 5d34a1d484..309a796cf9 100644 --- a/docs/guide-es/db-dao.md +++ b/docs/guide-es/db-dao.md @@ -14,7 +14,7 @@ Yii DAO soporta las siguientes bases de datos: - [MySQL](http://www.mysql.com/) - [MariaDB](https://mariadb.com/) - [SQLite](http://sqlite.org/) -- [PostgreSQL](http://www.postgresql.org/) +- [PostgreSQL](http://www.postgresql.org/): versión 8.4 o superior. - [CUBRID](http://www.cubrid.org/): versión 9.3 o superior. - [Oracle](http://www.oracle.com/us/products/database/overview/index.html) - [MSSQL](https://www.microsoft.com/en-us/sqlserver/default.aspx): versión 2008 o superior. diff --git a/docs/guide-fr/db-dao.md b/docs/guide-fr/db-dao.md index 1e162b583f..af899f1cd3 100644 --- a/docs/guide-fr/db-dao.md +++ b/docs/guide-fr/db-dao.md @@ -10,7 +10,7 @@ Les objets d'accès aux bases de données de Yii prennent en charge les bases de - [MySQL](http://www.mysql.com/) - [MariaDB](https://mariadb.com/) - [SQLite](http://sqlite.org/) -- [PostgreSQL](http://www.postgresql.org/) +- [PostgreSQL](http://www.postgresql.org/): version 8.4 or higher. - [CUBRID](http://www.cubrid.org/): version 9.3 or higher. - [Oracle](http://www.oracle.com/us/products/database/overview/index.html) - [MSSQL](https://www.microsoft.com/en-us/sqlserver/default.aspx): version 2008 or higher. diff --git a/docs/guide-ja/db-dao.md b/docs/guide-ja/db-dao.md index 4794538e69..64c0dd9483 100644 --- a/docs/guide-ja/db-dao.md +++ b/docs/guide-ja/db-dao.md @@ -13,7 +13,7 @@ Yii は下記の DBMS のサポートを内蔵しています。 - [MySQL](http://www.mysql.com/) - [MariaDB](https://mariadb.com/) - [SQLite](http://sqlite.org/) -- [PostgreSQL](http://www.postgresql.org/) +- [PostgreSQL](http://www.postgresql.org/): バージョン 8.4 以上。 - [CUBRID](http://www.cubrid.org/): バージョン 9.3 以上。 - [Oracle](http://www.oracle.com/us/products/database/overview/index.html) - [MSSQL](https://www.microsoft.com/en-us/sqlserver/default.aspx): バージョン 2008 以上。 diff --git a/docs/guide-pl/db-active-record.md b/docs/guide-pl/db-active-record.md index 9af6693ff8..72866623cf 100644 --- a/docs/guide-pl/db-active-record.md +++ b/docs/guide-pl/db-active-record.md @@ -27,7 +27,7 @@ $db->createCommand('INSERT INTO `customer` (`name`) VALUES (:name)', [ Yii zapewnia wsparcie Active Record dla następujących typów relacyjnych baz danych: * MySQL 4.1 lub nowszy: poprzez [[yii\db\ActiveRecord]] -* PostgreSQL 7.3 lub nowszy: poprzez [[yii\db\ActiveRecord]] +* PostgreSQL 8.4 lub nowszy: poprzez [[yii\db\ActiveRecord]] * SQLite 2 i 3: poprzez [[yii\db\ActiveRecord]] * Microsoft SQL Server 2008 lub nowszy: poprzez [[yii\db\ActiveRecord]] * Oracle: poprzez [[yii\db\ActiveRecord]] diff --git a/docs/guide-pt-BR/db-active-record.md b/docs/guide-pt-BR/db-active-record.md index 69595217e6..5139cc6864 100644 --- a/docs/guide-pt-BR/db-active-record.md +++ b/docs/guide-pt-BR/db-active-record.md @@ -22,7 +22,7 @@ $db->createCommand('INSERT INTO `customer` (`name`) VALUES (:name)', [ O Yii fornece suporte Active Record para os seguintes bancos de dados relacionais: * MySQL 4.1 ou superior: via [[yii\db\ActiveRecord]] -* PostgreSQL 7.3 ou superior: via [[yii\db\ActiveRecord]] +* PostgreSQL 8.4 ou superior: via [[yii\db\ActiveRecord]] * SQLite 2 e 3: via [[yii\db\ActiveRecord]] * Microsoft SQL Server 2008 ou superior: via [[yii\db\ActiveRecord]] * Oracle: via [[yii\db\ActiveRecord]] diff --git a/docs/guide-ru/db-dao.md b/docs/guide-ru/db-dao.md index 0c710f9d04..15f4b95e26 100644 --- a/docs/guide-ru/db-dao.md +++ b/docs/guide-ru/db-dao.md @@ -15,7 +15,7 @@ Yii DAO из коробки поддерживает следующие базы - [MySQL](http://www.mysql.com/) - [MariaDB](https://mariadb.com/) - [SQLite](http://sqlite.org/) -- [PostgreSQL](http://www.postgresql.org/) +- [PostgreSQL](http://www.postgresql.org/): версии 8.4 или выше. - [CUBRID](http://www.cubrid.org/): версии 9.3 или выше. - [Oracle](http://www.oracle.com/us/products/database/overview/index.html) - [MSSQL](https://www.microsoft.com/en-us/sqlserver/default.aspx): версии 2008 или выше. diff --git a/docs/guide-zh-CN/db-dao.md b/docs/guide-zh-CN/db-dao.md index a813e8a4ae..0aa6036639 100644 --- a/docs/guide-zh-CN/db-dao.md +++ b/docs/guide-zh-CN/db-dao.md @@ -7,7 +7,7 @@ Yii 默认支持以下数据库 (DBMS): - [MySQL](http://www.mysql.com/) - [MariaDB](https://mariadb.com/) - [SQLite](http://sqlite.org/) -- [PostgreSQL](http://www.postgresql.org/) +- [PostgreSQL](http://www.postgresql.org/): 版本 >= 8.4 - [CUBRID](http://www.cubrid.org/): 版本 >= 9.3 . (由于PHP PDO 扩展的一个[bug](http://jira.cubrid.org/browse/APIS-658) 引用值会无效,所以你需要在 CUBRID的客户端和服务端都使用 9.3 ) - [Oracle](http://www.oracle.com/us/products/database/overview/index.html) - [MSSQL](https://www.microsoft.com/en-us/sqlserver/default.aspx): 版本>=2005. diff --git a/docs/guide/db-dao.md b/docs/guide/db-dao.md index 0464d365f5..931fc8566c 100644 --- a/docs/guide/db-dao.md +++ b/docs/guide/db-dao.md @@ -14,7 +14,7 @@ Yii DAO supports the following databases out of box: - [MySQL](http://www.mysql.com/) - [MariaDB](https://mariadb.com/) - [SQLite](http://sqlite.org/) -- [PostgreSQL](http://www.postgresql.org/) +- [PostgreSQL](http://www.postgresql.org/): version 8.4 or higher - [CUBRID](http://www.cubrid.org/): version 9.3 or higher. - [Oracle](http://www.oracle.com/us/products/database/overview/index.html) - [MSSQL](https://www.microsoft.com/en-us/sqlserver/default.aspx): version 2008 or higher. diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 4d99483857..b26f1cac0a 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -12,6 +12,7 @@ Yii Framework 2 Change Log - Bug #11230: Include `defaultRoles` in `yii\rbac\DbManager->getRolesByUser()` results (developeruz) - Bug #13343: Fixed `yii\i18n\Formatter::asTime()` to process time-only values without time zone conversion (bizley) - Bug #11404: `yii\base\Model::loadMultiple()` returns true even if `yii\base\Model::load()` returns false (zvook) +- Bug #13577: `yii\db\QueryBuilder::truncateTable` should work consistent over all databases (boboldehampsink) - Enh #13577: Implemented `yii\db\mssql\QueryBuilder::resetSequence()` (boboldehampsink) - Bug #13513: Fixed RBAC migration to work correctly on Oracle DBMS (silverfire) - Enh #13550: Refactored unset call order in `yii\di\ServiceLocator::set()` (Lanrik) diff --git a/framework/db/pgsql/QueryBuilder.php b/framework/db/pgsql/QueryBuilder.php index 46e98f11db..2f6127f894 100644 --- a/framework/db/pgsql/QueryBuilder.php +++ b/framework/db/pgsql/QueryBuilder.php @@ -205,6 +205,17 @@ class QueryBuilder extends \yii\db\QueryBuilder return $command; } + /** + * Builds a SQL statement for truncating a DB table. + * Explicitly restarts identity for PGSQL to be consistent with other databases which all do this by default. + * @param string $table the table to be truncated. The name will be properly quoted by the method. + * @return string the SQL statement for truncating a DB table. + */ + public function truncateTable($table) + { + return 'TRUNCATE TABLE ' . $this->db->quoteTableName($table) . ' RESTART IDENTITY'; + } + /** * Builds a SQL statement for changing the definition of a column. * @param string $table the table whose column is to be changed. The table name will be properly quoted by the method.