Foreign keys / Transactions in MySQL.. WTF?

Dave Cross dave at dave.org.uk
Tue Jul 31 09:20:43 BST 2007


Quoting Toby Corkindale <tjc at wintrmute.net>:

> The MySQL advocates seem to suggest that MySQL *is* a RDMS. Silly me  
> for believing them :)

You can make MySQL work a lot more closely to how sane people expect  
databases to work if you put the server into "strict mode".

See http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html for  
more details.

The scary thing is the list of modes that you can turn on - which can  
be read as a list of errors that MySQL is usually quite happy to ignore.

 From that page's description of one of the stricter modes that can be  
employed.

   TRADITIONAL

   Make MySQL behave like a "traditional" SQL database system. A simple
   description of this mode is "give an error instead of a warning" when
   inserting an incorrect value into a column.

M'learned colleagues from the BBC can testify to the hilarity caused  
when I found that lurking in the documentation. Didn't go down very  
well with the (no doubt very expensive) MySQL consultant who was  
sitting opposite me at the time.

I've reached the conclusion that MySQL is a lot like Perl. By default  
it ignores most of your errors in order to give you warm fuzzy  
feelings. To turn it into a serious development tool you need to turn  
on strict.

Dave...

-- 
site: http://dave.org.uk/
blog: http://blog.dave.org.uk/




More information about the london.pm mailing list