Re: postgresql vs mysql - Mailing list pgsql-general

From Steve Crawford
Subject Re: postgresql vs mysql
Date
Msg-id 45DE3264.4020800@pinpointresearch.com
Whole thread Raw
In response to Re: postgresql vs mysql  (Ron Johnson <ron.l.johnson@cox.net>)
List 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

pgsql-general by date:

Previous
From: "Joris Dobbelsteen"
Date:
Subject: Re: complex referential integrity constraints
Next
From: "Andrej Ricnik-Bay"
Date:
Subject: Re: postgresql vs mysql