Skip to content

Commit 97cc74d

Browse files
Merge pull request #8997 from sbulen/30_pg_numeric_col
[3.0] Misc fixes affecting pg install
2 parents b341825 + d34afbc commit 97cc74d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Sources/Db/APIs/PostgreSQL.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ public function transaction(string $type = 'commit', ?object $connection = null)
690690
/**
691691
*
692692
*/
693-
public function error(object $connection): string
693+
public function error(?object $connection = null): string
694694
{
695695
if ($connection === null && $this->connection === null) {
696696
return '';
@@ -1820,7 +1820,11 @@ public function create_table(string $table_name, array $columns, array $indexes
18201820
}
18211821
$default = 'default nextval(\'' . $short_table_name . '_seq\')';
18221822
} elseif (isset($column['default']) && $column['default'] !== null) {
1823-
$default = 'default \'' . $this->escape_string($column['default']) . '\'';
1823+
// Numbers don't need quotes.
1824+
if (is_numeric($column['default']))
1825+
$default = 'default ' . $column['default'];
1826+
else
1827+
$default = 'default \'' . $this->escape_string($column['default']) . '\'';
18241828
} else {
18251829
$default = '';
18261830
}

0 commit comments

Comments
 (0)