>>>>> "Sergei" == Sergei Golubchik <serg@stripped> writes:
Sergei> On Apr 03, Krunal Bauskar wrote:
>> I recently discovered that values of date datatypes such as:
>> basically xxxx-00-00 are all valid values in non-strict mode (set
>> sql_mode = ' ';)
>> No warnings shown for these inserts.
>> But when the mode is traditional, I get a proper error.
>> Is this the correct behavior?
>> I fail to see any situation where 0 can be considered a valid month or day.
Sergei> Here's a situation: you have a library, and maintain the list of books
Sergei> in the database. You have a DATE column with 'Publication date'. But
Sergei> sometimes you don't know the exact date, but only the year - in this
Sergei> case month and day are 0.
Strict mode 'more or less' tells you that instead of warning you
should get an error. Normally in MySQL you don't get a warning for 00
in days or months and days.
If you don't want to have ZERO in a date field, add modes
NO_ZERO_IN_DATE and possible NO_ZERO_DATE to your sql mode and then
you are fine.