Skip to content

Commit

Permalink
postgresql 16 release (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
alikon authored Aug 19, 2024
1 parent 7abff99 commit 3927dea
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/Pgsql/PgsqlDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,13 @@ public function connect()
*/
public function getCollation()
{
$this->setQuery('SHOW LC_COLLATE');
// https://www.postgresql.org/docs/current/release-16.html
if (version_compare($this->getVersion(), '16.0', '>=')) {
$this->setQuery('SELECT datcollate AS lc_collate FROM pg_database WHERE datname = current_database()');
} else {
$this->setQuery('SHOW LC_COLLATE');
}

$array = $this->loadAssocList();

return $array[0]['lc_collate'];
Expand All @@ -127,7 +133,13 @@ public function getCollation()
*/
public function getConnectionCollation()
{
$this->setQuery('SHOW LC_COLLATE');
// https://www.postgresql.org/docs/current/release-16.html
if (version_compare($this->getVersion(), '16.0', '>=')) {
$this->setQuery('SELECT datcollate AS lc_collate FROM pg_database WHERE datname = current_database()');
} else {
$this->setQuery('SHOW LC_COLLATE');
}

$array = $this->loadAssocList();

return $array[0]['lc_collate'];
Expand Down

0 comments on commit 3927dea

Please sign in to comment.