Browse files

MDL-29567 postgresql - handle negative defaults in numerical cols pro…

…perly
  • Loading branch information...
1 parent 13e183d commit 00b4aadafe806fb1d2f8c5766bba11b1ab6b2bb4 @stronk7 stronk7 committed Sep 29, 2011
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/dml/pgsql_native_moodle_database.php
View
6 lib/dml/pgsql_native_moodle_database.php
@@ -415,7 +415,7 @@ public function get_columns($table, $usecache=true) {
$info->scale = null;
$info->not_null = ($rawcolumn->attnotnull === 't');
if ($info->has_default) {
- $info->default_value = $rawcolumn->adsrc;
+ $info->default_value = trim($rawcolumn->adsrc, '()');
} else {
$info->default_value = null;
}
@@ -433,7 +433,7 @@ public function get_columns($table, $usecache=true) {
$info->not_null = ($rawcolumn->attnotnull === 't');
$info->has_default = ($rawcolumn->atthasdef === 't');
if ($info->has_default) {
- $info->default_value = $rawcolumn->adsrc;
+ $info->default_value = trim($rawcolumn->adsrc, '()');
} else {
$info->default_value = null;
}
@@ -451,7 +451,7 @@ public function get_columns($table, $usecache=true) {
$info->not_null = ($rawcolumn->attnotnull === 't');
$info->has_default = ($rawcolumn->atthasdef === 't');
if ($info->has_default) {
- $info->default_value = $rawcolumn->adsrc;
+ $info->default_value = trim($rawcolumn->adsrc, '()');
} else {
$info->default_value = null;
}

0 comments on commit 00b4aad

Please sign in to comment.