Closed (fixed)
Project:
Drupal core
Version:
4.7.2
Component:
update system
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
19 Jun 2006 at 05:03 UTC
Updated:
3 Jul 2006 at 07:00 UTC
i think a lot of contrib updates get this wrong, and what they think is valid for pgsql support in fact throws errors. i've personally run into this 2 times, and there are probably a lot of others. the attached patch attempts to clarify the doxygen comments for this function, so that http://api.drupal.org/api/4.7/function/db_add_column will be more useful. basically, if you want a NOT NULL string field, you have to use:
array('not null' => TRUE, 'default' => "''")
as your $attributes array. a lot of people (including myself, after first reading the docs) think this works:
array('not null' => TRUE, 'default' => '')
thanks,
-derek
| Comment | File | Size | Author |
|---|---|---|---|
| db_add_column-doc.patch | 1.51 KB | dww |
Comments
Comment #1
dries commentedCommitted to HEAD.
I think this is a good example of why database abstraction layers are bad. It takes you 10 minutes to figure out how that NOT NULL is specified as ''.
Comment #2
dwwi disagree. ;) if we had an abstration layer, and everyone knew how to use it, there wouldn't be god-knows-how-many updates that are broken on pgsql that i'm going to run into as i start really trying to use pgsql. instead, everyone writes to mysql-aware sql, which is all they ever test, and pgsql remains broken. :(
(any reason not to apply this in DRUPAL-4-7?)
thanks for the quick commit, at least. ;)
-derek
Comment #3
(not verified) commented