My information is that MySQL does not enforce check constraints - your
testing supports this.

Regards.

rayB



|---------+---------------------------->
|         |           "Marcus Welz"    |
|         |           <[EMAIL PROTECTED]|
|         |           om>              |
|         |                            |
|         |           03/11/2005 11:59 |
|         |           Please respond to|
|         |           sqlite-users     |
|         |                            |
|---------+---------------------------->
  
>--------------------------------------------------------------------------------------------------------------|
  |                                                                             
                                 |
  |       To:       <sqlite-users@sqlite.org>                                   
                                 |
  |       cc:                                                                   
                                 |
  |       Subject:  RE: [sqlite] CHECK constraints                              
                                 |
  
>--------------------------------------------------------------------------------------------------------------|




To be honest, I didn't expect that either. I guess with NULL meaning
"absence of a value" the logic here is that since it cannot determine the
value of NULL, it let's it pass. Why that was chosen over failing the check
doesn't make sense to me.

MySQL 3.23.58 gives a syntax error on the table definition.

MySQL 4.0.24 inserts the record fine -- but it also inserts (5, 4). i.e. it
seems to ignore the check altogether.


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 02, 2005 7:43 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] CHECK constraints

"Marcus Welz" <[EMAIL PROTECTED]> wrote:
> PostgreSQL 8.0 will happily insert (5, NULL).
>

Hmmm..  Not what I expected, nor what I implemented.
But the implementation is easily changed and there is
no point in trying to be "logical" about the behavior
of NULLs, I've learned.  I will probably modify SQLite
to conform to PostgreSQL unless there is a serious
outcry against this, or unless someone learns that
PostgreSQL intends to change their behavior...

I'm eager to hear what other RDBMSes do.

--
D. Richard Hipp <[EMAIL PROTECTED]>








************** PLEASE CONSIDER OUR ENVIRONMENT BEFORE PRINTING *************
******************* Confidentiality and Privilege Notice *******************

This e-mail is intended only to be read or used by the addressee. It is
confidential and may contain legally privileged information. If you are not
the addressee indicated in this message (or responsible for delivery of the
message to such person), you may not copy or deliver this message to anyone,
and you should destroy this message and kindly notify the sender by reply
e-mail. Confidentiality and legal privilege are not waived or lost by reason
of mistaken delivery to you.

Qantas Airways Limited
ABN 16 009 661 901

Visit Qantas online at http://qantas.com

****************************************************************************

Reply via email to