diff --git a/src/Pgsql/PgsqlDriver.php b/src/Pgsql/PgsqlDriver.php index 12717a5eb..b9767b7b9 100644 --- a/src/Pgsql/PgsqlDriver.php +++ b/src/Pgsql/PgsqlDriver.php @@ -271,17 +271,17 @@ public function getTableColumns($table, $typeOnly = true) { if ($field->Default !== null) { - // Change Postgresql's NULL::* type with PHP's null one - if (preg_match('/^NULL::*/', $field->Default)) - { - $field->Default = null; - } - // Normalise default values like datetime if (preg_match('/^\'(.*)\'::.*/', $field->Default, $matches)) { $field->Default = $matches[1]; } + + // Change Postgresql's NULL::* type with PHP's null one. Do this last to avoid PHP type issues in PHP 8.1 and up + if (preg_match('/^NULL::*/', $field->Default)) + { + $field->Default = null; + } } // Do some dirty translation to MySQL output.