summaryrefslogtreecommitdiff
path: root/datadict/datadict-postgres.inc.php
diff options
context:
space:
mode:
authorMark Newnham <mark@newnhams.com>2026-02-09 15:55:41 -0700
committerMark Newnham <mark@newnhams.com>2026-02-09 15:55:41 -0700
commitf67b2273187925d5b84a4747bc91c2f32d9e8444 (patch)
tree737b375afa5617c640d50744ca8d3e5d38a235fb /datadict/datadict-postgres.inc.php
parentd86521c62332cf3165326c4814c8726286fe27d1 (diff)
downloadadodb-f67b2273187925d5b84a4747bc91c2f32d9e8444.tar.gz
adodb-f67b2273187925d5b84a4747bc91c2f32d9e8444.tar.bz2
adodb-f67b2273187925d5b84a4747bc91c2f32d9e8444.zip
Obtains values of $v and $t before use
Diffstat (limited to 'datadict/datadict-postgres.inc.php')
-rw-r--r--datadict/datadict-postgres.inc.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/datadict/datadict-postgres.inc.php b/datadict/datadict-postgres.inc.php
index 0839a331..97b3f675 100644
--- a/datadict/datadict-postgres.inc.php
+++ b/datadict/datadict-postgres.inc.php
@@ -231,6 +231,10 @@ class ADODB2_postgres extends ADODB_DataDict
$existing = $this->metaColumns($tabname);
list(,$colname,$default) = $matches;
$alter .= $colname;
+
+ $v = preg_replace('/^' . preg_quote($colname) . '\s/', '', $v);
+ $t = trim(str_replace('DEFAULT '.$default,'',$v));
+
if ($this->connection) {
if (array_key_exists(strtoupper($colname), $existing)) {
$old_coltype = $this->connection->metaType($existing[strtoupper($colname)]);
@@ -240,9 +244,6 @@ class ADODB2_postgres extends ADODB_DataDict
} else {
$old_coltype = $t;
}
- $v = preg_replace('/^' . preg_quote($colname) . '\s/', '', $v);
- $t = trim(str_replace('DEFAULT '.$default,'',$v));
-
// Type change from bool to int
if ( $old_coltype == 'L' && $t == 'INTEGER' ) {
$sql[] = $alter . ' DROP DEFAULT';