Closed (outdated)
Project:
Drupal core
Version:
7.x-dev
Component:
database system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Sep 2009 at 17:50 UTC
Updated:
4 May 2010 at 13:46 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
kkaefer commentedComment #2
kkaefer commentedSame for pgsql (untested!)
Comment #3
kkaefer commentedBTW, I noticed that the pgsql version lacks the
part. Is this on purpose or should that be added to pgsql as well?
Comment #4
kkaefer commentedAlso ignore the default value when the field is a serial.
Comment #5
Crell commentedSince we don't use "real" booleans in the database anyway, shouldn't we just tell people to use 1/0 instead of TRUE/FALSE for an int field? They'll have to write 1/0 to it in insert/update statements anyway rather than TRUE/FALSE, so cleaning up after them here and not elsewhere doesn't make sense.
Comment #6
kkaefer commentedDo they? when you update an int column, you specify int in the dbal and it converts TRUE/FALSE automatically to int. That was my understanding thus far.
Comment #8
jbrown commentedNote that default values are also not handled correct for fields with 'serialize' => TRUE.
Say you want a default value of array() in a serialized field. The default value should be serialized by the database layer before being put into the create table query, otherwise it will cause an exception.
Simply setting the default value to 'a:0:{}' will not work as then drupal_write_record() will serialize this to s:6:"a:0:{}";
Comment #9
Crell commentedkkaefer: Drupal 6 did so implicitly because we preprocessed all values. The D7 API doesn't do that anymore, as it passes (almost) all type juggling off to the database itself via prepared statements where they belong.
Comment #10
berdirThis is related to #403840: Cast numeric values at the level of the DB driver. If we don't fix that (suggested by Josh Waihi in #403840-14: Cast numeric values at the level of the DB driver, then there is no point in fixing this either.