Re: error in comparing date with datetime
Sergei Golubchik <[email protected]>
| Newsgroups | gmane.comp.db.mysql.bugs |
|---|---|
| Message-ID | <[email protected]> |
Hi! On May 03, P.B.van.den.Berg wrote: > On Tue, 23 Mar 2004 20:21:50 +0200 > Sinisa Milivojevic <[email protected]> wrote: > >Paul B van den Berg writes: > > I was wrong in my initial email where I stated that a date and a > datetime should be equal. However, the SQL-specification states that a > date and a datetime cannot be compared at all. > Shouldn't MySQL report an error if you try to do it? Strictly speaking, yes. Same for comparison of a string and an integer. But MySQL was always very forgiving in this regard, and always tried to perform an implicit type cast if possible. It was one of the original "easy of use" features. Though we do care about SQL compliance much more now than five years ago :) backward compatibility and ease of use are good things too. In this particular case it means that we're considering adding a switch (or, rather, an "sql_mode") to disable automatic type casts. Regards, Sergei -- __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Sergei Golubchik <[email protected]> / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Senior Software Developer /_/ /_/\_, /___/\___\_\___/ Osnabrueck, Germany <___/ www.mysql.com -- MySQL Bugs Mailing List For list archives: http://lists.mysql.com/bugs To unsubscribe: http://lists.mysql.com/[email protected]