Unverified Commit faefe46d authored by Michael Moravec's avatar Michael Moravec Committed by Sergei Morozov

Drop support for PostgreSQL <9.3

parent 0a18df20
...@@ -21,7 +21,7 @@ before_commands: ...@@ -21,7 +21,7 @@ before_commands:
tools: tools:
external_code_coverage: external_code_coverage:
timeout: 3600 timeout: 3600
runs: 30 # 25x Travis (jobs with COVERAGE=yes) + 3x AppVeyor (jobs with coverage=yes) + 2x ContinuousPHP runs: 29 # 24x Travis (jobs with COVERAGE=yes) + 3x AppVeyor (jobs with coverage=yes) + 2x ContinuousPHP
filter: filter:
excluded_paths: excluded_paths:
......
...@@ -184,13 +184,6 @@ jobs: ...@@ -184,13 +184,6 @@ jobs:
env: DB=mariadb.mysqli MARIADB_VERSION=10.3 COVERAGE=yes env: DB=mariadb.mysqli MARIADB_VERSION=10.3 COVERAGE=yes
addons: addons:
mariadb: 10.3 mariadb: 10.3
- stage: Test
php: 7.3
env: DB=pgsql POSTGRESQL_VERSION=9.2 COVERAGE=yes
services:
- postgresql
addons:
postgresql: "9.2"
- stage: Test - stage: Test
php: 7.3 php: 7.3
env: DB=pgsql POSTGRESQL_VERSION=9.3 COVERAGE=yes env: DB=pgsql POSTGRESQL_VERSION=9.3 COVERAGE=yes
......
# Upgrade to 3.0 # Upgrade to 3.0
## BC BREAK: Removed support for PostgreSQL 9.2 and older
DBAL now requires PostgeSQL 9.3 or newer, support for unmaintained versions has been dropped.
If you are using any of the legacy versions, you have to upgrade to newer PostgreSQL version (9.6+ is recommended).
`Doctrine\DBAL\Platforms\PostgreSqlPlatform` and `Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords` now represent the PostgreSQL 9.3.
The following classes have been removed:
* `Doctrine\DBAL\Platforms\PostgreSQL91Platform`
* `Doctrine\DBAL\Platforms\PostgreSQL92Platform`
* `Doctrine\DBAL\Platforms\Keywords\PostgreSQL91Keywords`
* `Doctrine\DBAL\Platforms\Keywords\PostgreSQL92Keywords`
## BC BREAK: Removed Doctrine\DBAL\Version ## BC BREAK: Removed Doctrine\DBAL\Version
The Doctrine\DBAL\Version class is no longer available: please refrain from checking the DBAL version at runtime. The Doctrine\DBAL\Version class is no longer available: please refrain from checking the DBAL version at runtime.
......
...@@ -229,20 +229,20 @@ pdo_pgsql ...@@ -229,20 +229,20 @@ pdo_pgsql
- ``sslmode`` (string): Determines whether or with what priority - ``sslmode`` (string): Determines whether or with what priority
a SSL TCP/IP connection will be negotiated with the server. a SSL TCP/IP connection will be negotiated with the server.
See the list of available modes: See the list of available modes:
`http://www.postgresql.org/docs/9.1/static/libpq-connect.html#LIBPQ-CONNECT-SSLMODE` `https://www.postgresql.org/docs/9.3/static/libpq-connect.html#LIBPQ-CONNECT-SSLMODE`
- ``sslrootcert`` (string): specifies the name of a file containing - ``sslrootcert`` (string): specifies the name of a file containing
SSL certificate authority (CA) certificate(s). If the file exists, SSL certificate authority (CA) certificate(s). If the file exists,
the server's certificate will be verified to be signed by one of these the server's certificate will be verified to be signed by one of these
authorities. authorities.
See http://www.postgresql.org/docs/9.0/static/libpq-connect.html#LIBPQ-CONNECT-SSLROOTCERT See https://www.postgresql.org/docs/9.3/static/libpq-connect.html#LIBPQ-CONNECT-SSLROOTCERT
- ``sslcert`` (string): specifies the file name of the client SSL certificate. - ``sslcert`` (string): specifies the file name of the client SSL certificate.
See `https://www.postgresql.org/docs/9.1/static/libpq-connect.html#LIBPQ-CONNECT-SSLCERT` See `https://www.postgresql.org/docs/9.3/static/libpq-connect.html#LIBPQ-CONNECT-SSLCERT`
- ``sslkey`` (string): specifies the location for the secret key used for the - ``sslkey`` (string): specifies the location for the secret key used for the
client certificate. client certificate.
See `https://www.postgresql.org/docs/9.1/static/libpq-connect.html#LIBPQ-CONNECT-SSLKEY` See `https://www.postgresql.org/docs/9.3/static/libpq-connect.html#LIBPQ-CONNECT-SSLKEY`
- ``sslcrl`` (string): specifies the file name of the SSL certificate - ``sslcrl`` (string): specifies the file name of the SSL certificate
revocation list (CRL). revocation list (CRL).
See `https://www.postgresql.org/docs/9.1/static/libpq-connect.html#LIBPQ-CONNECT-SSLCRL` See `https://www.postgresql.org/docs/9.3/static/libpq-connect.html#LIBPQ-CONNECT-SSLCRL`
- ``application_name`` (string): Name of the application that is - ``application_name`` (string): Name of the application that is
connecting to database. Optional. It will be displayed at ``pg_stat_activity``. connecting to database. Optional. It will be displayed at ``pg_stat_activity``.
......
...@@ -59,9 +59,8 @@ PostgreSQL ...@@ -59,9 +59,8 @@ PostgreSQL
^^^^^^^^^^ ^^^^^^^^^^
- ``PostgreSqlPlatform`` for all versions. - ``PostgreSqlPlatform`` for all versions.
- ``PostgreSQL91Platform`` for version 9.1 and above.
- ``PostgreSQL92Platform`` for version 9.2 and above.
- ``PostgreSQL94Platform`` for version 9.4 and above. - ``PostgreSQL94Platform`` for version 9.4 and above.
- ``PostgreSQL100Platform`` for version 10.0 and above.
SAP Sybase SQL Anywhere SAP Sybase SQL Anywhere
^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^
......
...@@ -749,9 +749,7 @@ Please also notice the mapping specific footnotes for additional information. ...@@ -749,9 +749,7 @@ Please also notice the mapping specific footnotes for additional information.
| | | | +----------------------------------------------------------+ | | | | +----------------------------------------------------------+
| | | | | ``LONGTEXT`` [19]_ | | | | | | ``LONGTEXT`` [19]_ |
| | +--------------------------+---------+----------------------------------------------------------+ | | +--------------------------+---------+----------------------------------------------------------+
| | | **PostgreSQL** | < 9.2 | ``TEXT`` [1]_ | | | | **PostgreSQL** | < 9.4 | ``JSON`` |
| | | +---------+----------------------------------------------------------+
| | | | < 9.4 | ``JSON`` |
| | | +---------+----------------------------------------------------------+ | | | +---------+----------------------------------------------------------+
| | | | >= 9.4 | ``JSON`` [20]_ | | | | | >= 9.4 | ``JSON`` [20]_ |
| | | | +----------------------------------------------------------+ | | | | +----------------------------------------------------------+
......
...@@ -7,8 +7,6 @@ use Doctrine\DBAL\DBALException; ...@@ -7,8 +7,6 @@ use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver; use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Exception; use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\PostgreSQL100Platform; use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
use Doctrine\DBAL\Platforms\PostgreSQL91Platform;
use Doctrine\DBAL\Platforms\PostgreSQL92Platform;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform; use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform; use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Schema\PostgreSqlSchemaManager; use Doctrine\DBAL\Schema\PostgreSqlSchemaManager;
...@@ -101,10 +99,6 @@ abstract class AbstractPostgreSQLDriver implements Driver, ExceptionConverterDri ...@@ -101,10 +99,6 @@ abstract class AbstractPostgreSQLDriver implements Driver, ExceptionConverterDri
return new PostgreSQL100Platform(); return new PostgreSQL100Platform();
case version_compare($version, '9.4', '>='): case version_compare($version, '9.4', '>='):
return new PostgreSQL94Platform(); return new PostgreSQL94Platform();
case version_compare($version, '9.2', '>='):
return new PostgreSQL92Platform();
case version_compare($version, '9.1', '>='):
return new PostgreSQL91Platform();
default: default:
return new PostgreSqlPlatform(); return new PostgreSqlPlatform();
} }
......
<?php
namespace Doctrine\DBAL\Platforms\Keywords;
/**
* PostgreSQL 9.1 reserved keywords list.
*/
class PostgreSQL91Keywords extends PostgreSQLKeywords
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'PostgreSQL91';
}
/**
* {@inheritdoc}
*
* @link http://www.postgresql.org/docs/9.1/static/sql-keywords-appendix.html
*/
protected function getKeywords()
{
return [
'ALL',
'ANALYSE',
'ANALYZE',
'AND',
'ANY',
'ARRAY',
'AS',
'ASC',
'ASYMMETRIC',
'AUTHORIZATION',
'BINARY',
'BOTH',
'CASE',
'CAST',
'CHECK',
'COLLATE',
'COLUMN',
'CONCURRENTLY',
'CONSTRAINT',
'CREATE',
'CROSS',
'CURRENT_CATALOG',
'CURRENT_DATE',
'CURRENT_ROLE',
'CURRENT_SCHEMA',
'CURRENT_TIME',
'CURRENT_TIMESTAMP',
'CURRENT_USER',
'DEFAULT',
'DEFERRABLE',
'DESC',
'DISTINCT',
'DO',
'ELSE',
'END',
'EXCEPT',
'FALSE',
'FETCH',
'FOR',
'FOREIGN',
'FREEZE',
'FROM',
'FULL',
'GRANT',
'GROUP',
'HAVING',
'ILIKE',
'IN',
'INITIALLY',
'INNER',
'INTERSECT',
'INTO',
'IS',
'ISNULL',
'JOIN',
'LEADING',
'LEFT',
'LIKE',
'LIMIT',
'LOCALTIME',
'LOCALTIMESTAMP',
'NATURAL',
'NOT',
'NOTNULL',
'NULL',
'OFFSET',
'ON',
'ONLY',
'OR',
'ORDER',
'OUTER',
'OVER',
'OVERLAPS',
'PLACING',
'PRIMARY',
'REFERENCES',
'RETURNING',
'RIGHT',
'SELECT',
'SESSION_USER',
'SIMILAR',
'SOME',
'SYMMETRIC',
'TABLE',
'THEN',
'TO',
'TRAILING',
'TRUE',
'UNION',
'UNIQUE',
'USER',
'USING',
'VARIADIC',
'VERBOSE',
'WHEN',
'WHERE',
'WINDOW',
'WITH',
];
}
}
<?php
namespace Doctrine\DBAL\Platforms\Keywords;
use function array_merge;
/**
* PostgreSQL 9.2 reserved keywords list.
*/
class PostgreSQL92Keywords extends PostgreSQL91Keywords
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'PostgreSQL92';
}
/**
* {@inheritdoc}
*
* @link http://www.postgresql.org/docs/9.2/static/sql-keywords-appendix.html
*/
protected function getKeywords()
{
return array_merge(parent::getKeywords(), ['COLLATION']);
}
}
...@@ -8,7 +8,7 @@ use function array_merge; ...@@ -8,7 +8,7 @@ use function array_merge;
/** /**
* PostgreSQL 9.4 reserved keywords list. * PostgreSQL 9.4 reserved keywords list.
*/ */
class PostgreSQL94Keywords extends PostgreSQL92Keywords class PostgreSQL94Keywords extends PostgreSQLKeywords
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
namespace Doctrine\DBAL\Platforms\Keywords; namespace Doctrine\DBAL\Platforms\Keywords;
/** /**
* PostgreSQL Keywordlist. * PostgreSQL 9.3 keywords list.
*/ */
class PostgreSQLKeywords extends KeywordList class PostgreSQLKeywords extends KeywordList
{ {
...@@ -26,20 +26,27 @@ class PostgreSQLKeywords extends KeywordList ...@@ -26,20 +26,27 @@ class PostgreSQLKeywords extends KeywordList
'ANALYZE', 'ANALYZE',
'AND', 'AND',
'ANY', 'ANY',
'ARRAY',
'AS', 'AS',
'ASC', 'ASC',
'ASYMMETRIC',
'AUTHORIZATION', 'AUTHORIZATION',
'BETWEEN',
'BINARY', 'BINARY',
'BOTH', 'BOTH',
'CASE', 'CASE',
'CAST', 'CAST',
'CHECK', 'CHECK',
'COLLATE', 'COLLATE',
'COLLATION',
'COLUMN', 'COLUMN',
'CONCURRENTLY',
'CONSTRAINT', 'CONSTRAINT',
'CREATE', 'CREATE',
'CROSS',
'CURRENT_CATALOG',
'CURRENT_DATE', 'CURRENT_DATE',
'CURRENT_ROLE',
'CURRENT_SCHEMA',
'CURRENT_TIME', 'CURRENT_TIME',
'CURRENT_TIMESTAMP', 'CURRENT_TIMESTAMP',
'CURRENT_USER', 'CURRENT_USER',
...@@ -52,6 +59,7 @@ class PostgreSQLKeywords extends KeywordList ...@@ -52,6 +59,7 @@ class PostgreSQLKeywords extends KeywordList
'END', 'END',
'EXCEPT', 'EXCEPT',
'FALSE', 'FALSE',
'FETCH',
'FOR', 'FOR',
'FOREIGN', 'FOREIGN',
'FREEZE', 'FREEZE',
...@@ -76,26 +84,27 @@ class PostgreSQLKeywords extends KeywordList ...@@ -76,26 +84,27 @@ class PostgreSQLKeywords extends KeywordList
'LOCALTIME', 'LOCALTIME',
'LOCALTIMESTAMP', 'LOCALTIMESTAMP',
'NATURAL', 'NATURAL',
'NEW',
'NOT', 'NOT',
'NOTNULL', 'NOTNULL',
'NULL', 'NULL',
'OFF',
'OFFSET', 'OFFSET',
'OLD',
'ON', 'ON',
'ONLY', 'ONLY',
'OR', 'OR',
'ORDER', 'ORDER',
'OUTER', 'OUTER',
'OVER',
'OVERLAPS', 'OVERLAPS',
'PLACING', 'PLACING',
'PRIMARY', 'PRIMARY',
'REFERENCES', 'REFERENCES',
'RETURNING',
'RIGHT',
'SELECT', 'SELECT',
'SESSION_USER', 'SESSION_USER',
'SIMILAR', 'SIMILAR',
'SOME', 'SOME',
'SYMMETRIC',
'TABLE', 'TABLE',
'THEN', 'THEN',
'TO', 'TO',
...@@ -105,9 +114,12 @@ class PostgreSQLKeywords extends KeywordList ...@@ -105,9 +114,12 @@ class PostgreSQLKeywords extends KeywordList
'UNIQUE', 'UNIQUE',
'USER', 'USER',
'USING', 'USING',
'VARIADIC',
'VERBOSE', 'VERBOSE',
'WHEN', 'WHEN',
'WHERE', 'WHERE',
'WINDOW',
'WITH',
]; ];
} }
} }
<?php
namespace Doctrine\DBAL\Platforms;
use function explode;
/**
* Provides the behavior, features and SQL dialect of the PostgreSQL 9.1 database platform.
*/
class PostgreSQL91Platform extends PostgreSqlPlatform
{
/**
* {@inheritDoc}
*/
public function supportsColumnCollation()
{
return true;
}
/**
* {@inheritdoc}
*/
protected function getReservedKeywordsClass()
{
return Keywords\PostgreSQL91Keywords::class;
}
/**
* {@inheritDoc}
*/
public function getColumnCollationDeclarationSQL($collation)
{
return 'COLLATE ' . $this->quoteSingleIdentifier($collation);
}
/**
* {@inheritDoc}
*/
public function getListTableColumnsSQL($table, $database = null)
{
$sql = parent::getListTableColumnsSQL($table, $database);
$parts = explode('AS complete_type,', $sql, 2);
return $parts[0] . 'AS complete_type, (SELECT tc.collcollate FROM pg_catalog.pg_collation tc WHERE tc.oid = a.attcollation) AS collation,' . $parts[1];
}
}
<?php
namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Types\Types;
use function sprintf;
/**
* Provides the behavior, features and SQL dialect of the PostgreSQL 9.2 database platform.
*/
class PostgreSQL92Platform extends PostgreSQL91Platform
{
/**
* {@inheritdoc}
*/
public function getJsonTypeDeclarationSQL(array $field)
{
return 'JSON';
}
/**
* {@inheritdoc}
*/
public function getSmallIntTypeDeclarationSQL(array $field)
{
if (! empty($field['autoincrement'])) {
return 'SMALLSERIAL';
}
return parent::getSmallIntTypeDeclarationSQL($field);
}
/**
* {@inheritdoc}
*/
public function hasNativeJsonType()
{
return true;
}
/**
* {@inheritdoc}
*/
protected function getReservedKeywordsClass()
{
return Keywords\PostgreSQL92Keywords::class;
}
/**
* {@inheritdoc}
*/
protected function initializeDoctrineTypeMappings()
{
parent::initializeDoctrineTypeMappings();
$this->doctrineTypeMapping['json'] = Types::JSON;
}
/**
* {@inheritdoc}
*/
public function getCloseActiveDatabaseConnectionsSQL($database)
{
return sprintf(
'SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = %s',
$this->quoteStringLiteral($database)
);
}
}
...@@ -7,7 +7,7 @@ use Doctrine\DBAL\Types\Types; ...@@ -7,7 +7,7 @@ use Doctrine\DBAL\Types\Types;
/** /**
* Provides the behavior, features and SQL dialect of the PostgreSQL 9.4 database platform. * Provides the behavior, features and SQL dialect of the PostgreSQL 9.4 database platform.
*/ */
class PostgreSQL94Platform extends PostgreSQL92Platform class PostgreSQL94Platform extends PostgreSqlPlatform
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}
......
...@@ -33,7 +33,7 @@ use function strtolower; ...@@ -33,7 +33,7 @@ use function strtolower;
use function trim; use function trim;
/** /**
* PostgreSqlPlatform. * Provides the behavior, features and SQL dialect of the PostgreSQL 9.4+ database platform.
* *
* @todo Rename: PostgreSQLPlatform * @todo Rename: PostgreSQLPlatform
*/ */
...@@ -392,6 +392,7 @@ SQL ...@@ -392,6 +392,7 @@ SQL
quote_ident(a.attname) AS field, quote_ident(a.attname) AS field,
t.typname AS type, t.typname AS type,
format_type(a.atttypid, a.atttypmod) AS complete_type, format_type(a.atttypid, a.atttypmod) AS complete_type,
(SELECT tc.collcollate FROM pg_catalog.pg_collation tc WHERE tc.oid = a.attcollation) AS collation,
(SELECT t1.typname FROM pg_catalog.pg_type t1 WHERE t1.oid = t.typbasetype) AS domain_type, (SELECT t1.typname FROM pg_catalog.pg_type t1 WHERE t1.oid = t.typbasetype) AS domain_type,
(SELECT format_type(t2.typbasetype, t2.typtypmod) FROM (SELECT format_type(t2.typbasetype, t2.typtypmod) FROM
pg_catalog.pg_type t2 WHERE t2.typtype = 'd' AND t2.oid = a.atttypid) AS domain_complete_type, pg_catalog.pg_type t2 WHERE t2.typtype = 'd' AND t2.oid = a.atttypid) AS domain_complete_type,
...@@ -452,7 +453,7 @@ SQL ...@@ -452,7 +453,7 @@ SQL
*/ */
public function getCloseActiveDatabaseConnectionsSQL($database) public function getCloseActiveDatabaseConnectionsSQL($database)
{ {
return 'SELECT pg_terminate_backend(procpid) FROM pg_stat_activity WHERE datname = ' return 'SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = '
. $this->quoteStringLiteral($database); . $this->quoteStringLiteral($database);
} }
...@@ -973,6 +974,10 @@ SQL ...@@ -973,6 +974,10 @@ SQL
*/ */
public function getSmallIntTypeDeclarationSQL(array $field) public function getSmallIntTypeDeclarationSQL(array $field)
{ {
if (! empty($field['autoincrement'])) {
return 'SMALLSERIAL';
}
return 'SMALLINT'; return 'SMALLINT';
} }
...@@ -1161,6 +1166,7 @@ SQL ...@@ -1161,6 +1166,7 @@ SQL
'year' => 'date', 'year' => 'date',
'uuid' => 'guid', 'uuid' => 'guid',
'bytea' => 'blob', 'bytea' => 'blob',
'json' => Type::JSON,
]; ];
} }
...@@ -1188,6 +1194,14 @@ SQL ...@@ -1188,6 +1194,14 @@ SQL
return 0; return 0;
} }
/**
* {@inheritdoc}
*/
public function hasNativeJsonType()
{
return true;
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
...@@ -1216,6 +1230,30 @@ SQL ...@@ -1216,6 +1230,30 @@ SQL
return parent::getDefaultValueDeclarationSQL($field); return parent::getDefaultValueDeclarationSQL($field);
} }
/**
* {@inheritdoc}
*/
public function supportsColumnCollation()
{
return true;
}
/**
* {@inheritdoc}
*/
public function getColumnCollationDeclarationSQL($collation)
{
return 'COLLATE ' . $this->quoteSingleIdentifier($collation);
}
/**
* {@inheritdoc}
*/
public function getJsonTypeDeclarationSQL(array $field)
{
return 'JSON';
}
/** /**
* @param mixed[] $field * @param mixed[] $field
*/ */
......
...@@ -8,8 +8,8 @@ use Doctrine\DBAL\Platforms\Keywords\MySQL57Keywords; ...@@ -8,8 +8,8 @@ use Doctrine\DBAL\Platforms\Keywords\MySQL57Keywords;
use Doctrine\DBAL\Platforms\Keywords\MySQL80Keywords; use Doctrine\DBAL\Platforms\Keywords\MySQL80Keywords;
use Doctrine\DBAL\Platforms\Keywords\MySQLKeywords; use Doctrine\DBAL\Platforms\Keywords\MySQLKeywords;
use Doctrine\DBAL\Platforms\Keywords\OracleKeywords; use Doctrine\DBAL\Platforms\Keywords\OracleKeywords;
use Doctrine\DBAL\Platforms\Keywords\PostgreSQL91Keywords; use Doctrine\DBAL\Platforms\Keywords\PostgreSQL100Keywords;
use Doctrine\DBAL\Platforms\Keywords\PostgreSQL92Keywords; use Doctrine\DBAL\Platforms\Keywords\PostgreSQL94Keywords;
use Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords; use Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords;
use Doctrine\DBAL\Platforms\Keywords\ReservedKeywordsValidator; use Doctrine\DBAL\Platforms\Keywords\ReservedKeywordsValidator;
use Doctrine\DBAL\Platforms\Keywords\SQLAnywhere11Keywords; use Doctrine\DBAL\Platforms\Keywords\SQLAnywhere11Keywords;
...@@ -43,8 +43,8 @@ class ReservedWordsCommand extends Command ...@@ -43,8 +43,8 @@ class ReservedWordsCommand extends Command
'sqlserver2012' => SQLServer2012Keywords::class, 'sqlserver2012' => SQLServer2012Keywords::class,
'sqlite' => SQLiteKeywords::class, 'sqlite' => SQLiteKeywords::class,
'pgsql' => PostgreSQLKeywords::class, 'pgsql' => PostgreSQLKeywords::class,
'pgsql91' => PostgreSQL91Keywords::class, 'pgsql94' => PostgreSQL94Keywords::class,
'pgsql92' => PostgreSQL92Keywords::class, 'pgsql100' => PostgreSQL100Keywords::class,
'oracle' => OracleKeywords::class, 'oracle' => OracleKeywords::class,
'db2' => DB2Keywords::class, 'db2' => DB2Keywords::class,
'sqlanywhere' => SQLAnywhereKeywords::class, 'sqlanywhere' => SQLAnywhereKeywords::class,
...@@ -101,7 +101,8 @@ The following keyword lists are currently shipped with Doctrine: ...@@ -101,7 +101,8 @@ The following keyword lists are currently shipped with Doctrine:
* mysql57 * mysql57
* mysql80 * mysql80
* pgsql * pgsql
* pgsql92 * pgsql94
* pgsql100
* sqlite * sqlite
* oracle * oracle
* sqlserver * sqlserver
...@@ -127,23 +128,7 @@ EOT ...@@ -127,23 +128,7 @@ EOT
$keywordLists = (array) $input->getOption('list'); $keywordLists = (array) $input->getOption('list');
if (! $keywordLists) { if (! $keywordLists) {
$keywordLists = [ $keywordLists = array_keys($this->keywordListClasses);
'mysql',
'mysql57',
'mysql80',
'pgsql',
'pgsql92',
'sqlite',
'oracle',
'sqlserver',
'sqlserver2005',
'sqlserver2008',
'sqlserver2012',
'sqlanywhere',
'sqlanywhere11',
'sqlanywhere12',
'sqlanywhere16',
];
} }
$keywords = []; $keywords = [];
......
...@@ -8,8 +8,6 @@ use Doctrine\DBAL\Driver\AbstractPostgreSQLDriver; ...@@ -8,8 +8,6 @@ use Doctrine\DBAL\Driver\AbstractPostgreSQLDriver;
use Doctrine\DBAL\Driver\ResultStatement; use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\PostgreSQL100Platform; use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
use Doctrine\DBAL\Platforms\PostgreSQL91Platform;
use Doctrine\DBAL\Platforms\PostgreSQL92Platform;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform; use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform; use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Schema\AbstractSchemaManager; use Doctrine\DBAL\Schema\AbstractSchemaManager;
...@@ -67,15 +65,9 @@ class AbstractPostgreSQLDriverTest extends AbstractDriverTest ...@@ -67,15 +65,9 @@ class AbstractPostgreSQLDriverTest extends AbstractDriverTest
protected function getDatabasePlatformsForVersions() : array protected function getDatabasePlatformsForVersions() : array
{ {
return [ return [
['9.0.9', PostgreSqlPlatform::class], ['9.3', PostgreSqlPlatform::class],
['9.1', PostgreSQL91Platform::class], ['9.3.0', PostgreSqlPlatform::class],
['9.1.0', PostgreSQL91Platform::class], ['9.3.6', PostgreSqlPlatform::class],
['9.1.1', PostgreSQL91Platform::class],
['9.1.9', PostgreSQL91Platform::class],
['9.2', PostgreSQL92Platform::class],
['9.2.0', PostgreSQL92Platform::class],
['9.2.1', PostgreSQL92Platform::class],
['9.3.6', PostgreSQL92Platform::class],
['9.4', PostgreSQL94Platform::class], ['9.4', PostgreSQL94Platform::class],
['9.4.0', PostgreSQL94Platform::class], ['9.4.0', PostgreSQL94Platform::class],
['9.4.1', PostgreSQL94Platform::class], ['9.4.1', PostgreSQL94Platform::class],
......
<?php
namespace Doctrine\Tests\DBAL\Platforms;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\PostgreSQL91Platform;
use Doctrine\DBAL\Schema\Table;
class PostgreSQL91PlatformTest extends PostgreSqlPlatformTest
{
public function createPlatform() : AbstractPlatform
{
return new PostgreSQL91Platform();
}
public function testSupportsColumnCollation() : void
{
self::assertTrue($this->platform->supportsColumnCollation());
}
public function testColumnCollationDeclarationSQL() : void
{
self::assertSame(
'COLLATE "en_US.UTF-8"',
$this->platform->getColumnCollationDeclarationSQL('en_US.UTF-8')
);
}
public function testGetCreateTableSQLWithColumnCollation() : void
{
$table = new Table('foo');
$table->addColumn('no_collation', 'string');
$table->addColumn('column_collation', 'string')->setPlatformOption('collation', 'en_US.UTF-8');
self::assertSame(
['CREATE TABLE foo (no_collation VARCHAR(255) NOT NULL, column_collation VARCHAR(255) NOT NULL COLLATE "en_US.UTF-8")'],
$this->platform->getCreateTableSQL($table),
'Column "no_collation" will use the default collation from the table/database and "column_collation" overwrites the collation on this column'
);
}
}
<?php
namespace Doctrine\Tests\DBAL\Platforms;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\PostgreSQL92Platform;
use Doctrine\DBAL\Types\Types;
class PostgreSQL92PlatformTest extends AbstractPostgreSqlPlatformTestCase
{
/**
* {@inheritdoc}
*/
public function createPlatform() : AbstractPlatform
{
return new PostgreSQL92Platform();
}
/**
* @group DBAL-553
*/
public function testHasNativeJsonType() : void
{
self::assertTrue($this->platform->hasNativeJsonType());
}
/**
* @group DBAL-553
*/
public function testReturnsJsonTypeDeclarationSQL() : void
{
self::assertSame('JSON', $this->platform->getJsonTypeDeclarationSQL([]));
}
public function testReturnsSmallIntTypeDeclarationSQL() : void
{
self::assertSame(
'SMALLSERIAL',
$this->platform->getSmallIntTypeDeclarationSQL(['autoincrement' => true])
);
self::assertSame(
'SMALLINT',
$this->platform->getSmallIntTypeDeclarationSQL(['autoincrement' => false])
);
self::assertSame(
'SMALLINT',
$this->platform->getSmallIntTypeDeclarationSQL([])
);
}
/**
* @group DBAL-553
*/
public function testInitializesJsonTypeMapping() : void
{
self::assertTrue($this->platform->hasDoctrineTypeMappingFor('json'));
self::assertEquals(Types::JSON, $this->platform->getDoctrineTypeMapping('json'));
}
/**
* @group DBAL-1220
*/
public function testReturnsCloseActiveDatabaseConnectionsSQL() : void
{
self::assertSame(
"SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'foo'",
$this->platform->getCloseActiveDatabaseConnectionsSQL('foo')
);
}
}
...@@ -6,7 +6,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; ...@@ -6,7 +6,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform; use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Types\Types; use Doctrine\DBAL\Types\Types;
class PostgreSQL94PlatformTest extends PostgreSQL92PlatformTest class PostgreSQL94PlatformTest extends PostgreSqlPlatformTest
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}
......
...@@ -5,6 +5,7 @@ namespace Doctrine\Tests\DBAL\Platforms; ...@@ -5,6 +5,7 @@ namespace Doctrine\Tests\DBAL\Platforms;
use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform; use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Types\Type;
class PostgreSqlPlatformTest extends AbstractPostgreSqlPlatformTestCase class PostgreSqlPlatformTest extends AbstractPostgreSqlPlatformTestCase
{ {
...@@ -32,4 +33,66 @@ class PostgreSqlPlatformTest extends AbstractPostgreSqlPlatformTestCase ...@@ -32,4 +33,66 @@ class PostgreSqlPlatformTest extends AbstractPostgreSqlPlatformTestCase
'Comments are added to table.' 'Comments are added to table.'
); );
} }
public function testColumnCollationDeclarationSQL() : void
{
self::assertEquals(
'COLLATE "en_US.UTF-8"',
$this->platform->getColumnCollationDeclarationSQL('en_US.UTF-8')
);
}
/**
* @group DBAL-553
*/
public function testHasNativeJsonType() : void
{
self::assertTrue($this->platform->hasNativeJsonType());
}
/**
* @group DBAL-553
*/
public function testReturnsJsonTypeDeclarationSQL() : void
{
self::assertSame('JSON', $this->platform->getJsonTypeDeclarationSQL([]));
}
public function testReturnsSmallIntTypeDeclarationSQL() : void
{
self::assertSame(
'SMALLSERIAL',
$this->platform->getSmallIntTypeDeclarationSQL(['autoincrement' => true])
);
self::assertSame(
'SMALLINT',
$this->platform->getSmallIntTypeDeclarationSQL(['autoincrement' => false])
);
self::assertSame(
'SMALLINT',
$this->platform->getSmallIntTypeDeclarationSQL([])
);
}
/**
* @group DBAL-553
*/
public function testInitializesJsonTypeMapping() : void
{
self::assertTrue($this->platform->hasDoctrineTypeMappingFor('json'));
self::assertEquals(Type::JSON, $this->platform->getDoctrineTypeMapping('json'));
}
/**
* @group DBAL-1220
*/
public function testReturnsCloseActiveDatabaseConnectionsSQL() : void
{
self::assertSame(
"SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'foo'",
$this->platform->getCloseActiveDatabaseConnectionsSQL('foo')
);
}
} }
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