Skip to content
Snippets Groups Projects
Commit ee47a2bf authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

#256001 by bjaspan, stormsweeper, Darren Oh: pgsql driver does not handle...

#256001 by bjaspan, stormsweeper, Darren Oh: pgsql driver does not handle unsigned numeric fields properly
parent 15ba057f
No related merge requests found
......@@ -579,14 +579,6 @@ function _db_create_field_sql($name, $spec) {
if ($spec['type'] == 'serial') {
unset($spec['not null']);
}
if (!empty($spec['unsigned'])) {
if ($spec['type'] == 'serial') {
$sql .= " CHECK ($name >= 0)";
}
else {
$sql .= '_unsigned';
}
}
if (in_array($spec['type'], array('varchar', 'char', 'text')) && isset($spec['length'])) {
$sql .= '('. $spec['length'] .')';
......@@ -595,6 +587,10 @@ function _db_create_field_sql($name, $spec) {
$sql .= '('. $spec['precision'] .', '. $spec['scale'] .')';
}
if (!empty($spec['unsigned'])) {
$sql .= " CHECK ($name >= 0)";
}
if (isset($spec['not null']) && $spec['not null']) {
$sql .= ' NOT NULL';
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment