Skip to content

Commit 6107f3f

Browse files
committed
DP-248 Confirm PostgreSQL 13 support
- fix to support any pgsql version higher than 12
1 parent ce26bdc commit 6107f3f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Database/Schema/PostgresSchema.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,9 @@ protected function loadTableColumns(TableSchema $table)
286286
{
287287
$params = [':table' => $table->resourceName, ':schema' => $table->schemaName];
288288
$version = $this->connection->select('select version();')[0]->version;
289-
$adsrc = strpos($version, 'PostgreSQL 12') !== false ? 'pg_get_expr(d.adbin, d.adrelid) AS adsrc' : 'd.adsrc';
289+
preg_match("/PostgreSQL (\d.*?)\s/i", $version, $matches);
290+
$version = (float)$matches[1];
291+
$adsrc = $version >= 12 ? 'pg_get_expr(d.adbin, d.adrelid) AS adsrc' : 'd.adsrc';
290292
$sql = <<<SQL
291293
SELECT a.attname, LOWER(format_type(a.atttypid, a.atttypmod)) AS type, $adsrc, a.attnotnull, a.atthasdef,
292294
pg_catalog.col_description(a.attrelid, a.attnum) AS comment

0 commit comments

Comments
 (0)