[database] [Database] Toward better databases
Barry Jaspan
barry.jaspan at acquia.com
Tue Jul 8 15:26:58 UTC 2008
David,
On Jul 7, 2008, at 11:02 PM, David Timothy Strauss wrote:
> MySQL requires non-null defaults for non-null columns. What's the
> problem?
Ummmm.. really? My understanding is that MySQL provides implicit
default values for NOT NULL columns that are not given a default value
when not in strict mode, but that isn't the same as requiring that a
non-null default be provided.
During the D6 switch to Schema API, I tried to remove all the
unnecessary/incorrect default values on columns. For the variable
table, a default name of '' is semantically ridiculous; we should
never have a variable whose name is the empty string and there should
never be an INSERT statement into that table that does not provide a
value for name. So why have the default value at all?
Barry
>
>
> ----- "Joshua D. Drake" <jd at commandprompt.com> wrote:
>
>> On Mon, 2008-07-07 at 20:42 -0500, Larry Garfield wrote:
>>> On Monday 07 July 2008 8:44:40 am you wrote:
>>>> Howdy, everyone. Here's my current brain-dump:
>>
>>> CREATE TABLE variable (
>>> name varchar(128) NOT NULL default '',
>>> value text NOT NULL,
>>> PRIMARY KEY (name)
>>> )
>>>
>>
>> I would also note that the above is horribly bad.
>>
>> You just said that your primary key is name but that its default is
>> '',
>> that protects against NOT NULL but allows a single '' as well as a
>> single ' ' or ' ' or ' ' etc...
>>
>> Sincerely,
>>
>> Joshua D. Drake
>>
>>
>> _______________________________________________
>> Database mailing list
>> Database at drupal.org
>> http://mail.drupal.org/mailman/listinfo/database
> _______________________________________________
> Database mailing list
> Database at drupal.org
> http://mail.drupal.org/mailman/listinfo/database
More information about the Database
mailing list