Skip to content

Commit 009375c

Browse files
Justin Painterkoenpunt
authored andcommitted
Fix PgsqlAdapter native types, default values.
* The native types array were missing 'real','bigint','smallint', 'double precision', 'decimal' and 'numeric'. See: http://www.postgresql.org/docs/9.1/static/datatype-numeric.html * Both 0 and the empty string "" are valid defaults but were not being recognized. Changed to check explicitly for NULL defaults.
1 parent bac82b6 commit 009375c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/adapters/PgsqlAdapter.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function create_column(&$column)
101101

102102
$c->map_raw_type();
103103

104-
if ($column['default'])
104+
if (!is_null($column['default']))
105105
{
106106
preg_match("/^nextval\('(.*)'\)$/",$column['default'],$matches);
107107

@@ -131,7 +131,13 @@ public function native_database_types()
131131
'time' => array('name' => 'time'),
132132
'date' => array('name' => 'date'),
133133
'binary' => array('name' => 'binary'),
134-
'boolean' => array('name' => 'boolean')
134+
'boolean' => array('name' => 'boolean'),
135+
'bigint' => array('name' => 'integer'),
136+
'smallint' => array('name' => 'integer'),
137+
'real' => array('name' => 'float'),
138+
'double precision' => array('name' => 'float'),
139+
'numeric' => array('name' => 'float'),
140+
'decimal' => array('name' => 'float')
135141
);
136142
}
137143

0 commit comments

Comments
 (0)