PostgreSQL91Platform.php 1.06 KB
Newer Older
1 2 3 4
<?php

namespace Doctrine\DBAL\Platforms;

5 6
use function explode;

7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/**
 * 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()
    {
25
        return Keywords\PostgreSQL91Keywords::class;
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
    }

    /**
     * {@inheritDoc}
     */
    public function getColumnCollationDeclarationSQL($collation)
    {
        return 'COLLATE ' . $this->quoteSingleIdentifier($collation);
    }

    /**
     * {@inheritDoc}
     */
    public function getListTableColumnsSQL($table, $database = null)
    {
41
        $sql   = parent::getListTableColumnsSQL($table, $database);
42 43
        $parts = explode('AS complete_type,', $sql, 2);

44
        return $parts[0] . 'AS complete_type, (SELECT tc.collcollate FROM pg_catalog.pg_collation tc WHERE tc.oid = a.attcollation) AS collation,' . $parts[1];
45 46
    }
}