Re: postgresql vs mysql

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: postgresql vs mysql
Date: 2007-02-23 00:16:36
Message-ID: 45DE3264.4020800@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ron Johnson wrote:
> On 02/21/07 18:09, Erick Papadakis wrote:
>> How would you like to use a database that has nuances like these --
>> http://forums.mysql.com/read.php?20,141120,141120#msg-141120
>
> Huh?
>
> A blank string (does that mean '' or ' '?) is not NULL, so of
> *course* it should pass the NOT NULL constraint.
>
> Or am I missing something?
>

Not sure what the OP was getting at but of course an empty string is not
the same as a NULL. You have to follow that MySQL forum thread a few
messages to see the real screwup. Upon learning that an empty string is
not the same a a NULL, he adds a constraint:

ALTER TABLE `tbl`
CHANGE `col`
`col` VARCHAR( 3 ) CHECK (`col` <>'')
NOT NULL

Unfortunately for him, this does not work either. The reason is
clarified in the following message:

"Currently MySQL accepts CHECK syntax but does not implement them. You
can enforce such a rule at database level with a trigger, or at
application level as another contributor suggested."

Huh?

Cheers,
Steve

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joris Dobbelsteen 2007-02-23 00:20:40 Re: complex referential integrity constraints
Previous Message Scott Marlowe 2007-02-23 00:08:28 Re: postgresql vs mysql