Skip to content

Commit

Permalink
Allow Quoted Default Values in Postgres DataDict - patch posted to ad…
Browse files Browse the repository at this point in the history
…odb forum

git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@5179 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
mantis committed Apr 20, 2008
1 parent cabddb5 commit 156910b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/adodb/datadict/datadict-postgres.inc.php
Expand Up @@ -135,7 +135,7 @@ function AddColumnSQL($tabname, $flds)
if (($not_null = preg_match('/NOT NULL/i',$v))) {
$v = preg_replace('/NOT NULL/i','',$v);
}
if (preg_match('/^([^ ]+) .*DEFAULT ([^ ]+)/',$v,$matches)) {
if (preg_match('/^([^ ]+) .*DEFAULT (\'[^\']+\'|\"[^\"]+\"|[^ ]+)/',$v,$matches)) {
list(,$colname,$default) = $matches;
$sql[] = $alter . str_replace('DEFAULT '.$default,'',$v);
$sql[] = 'UPDATE '.$tabname.' SET '.$colname.'='.$default;
Expand Down Expand Up @@ -200,7 +200,7 @@ function AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
$v = preg_replace('/\sNULL/i','',$v);
}

if (preg_match('/^([^ ]+) .*DEFAULT ([^ ]+)/',$v,$matches)) {
if (preg_match('/^([^ ]+) .*DEFAULT (\'[^\']+\'|\"[^\"]+\"|[^ ]+)/',$v,$matches)) {
$existing = $this->MetaColumns($tabname);
list(,$colname,$default) = $matches;
$v = preg_replace('/^' . preg_quote($colname) . '\s/', '', $v);
Expand Down

0 comments on commit 156910b

Please sign in to comment.