Kevin Fries wrote:
> I agree it's unfortunate that the dates get stored.  But some do seem
> to prefer it this way.
>
> To quote the manual at the bottom of:
> http://www.mysql.com/doc/en/Using_DATE.html
>
> If the date cannot be converted to any reasonable value, a 0 is
> stored in the DATE field, which will be retrieved as 0000-00-00. This
> is both a speed and convenience issue as we believe that the
> database's responsibility is to retrieve the same date you stored
> (even if the data was not logically correct in all cases). We think
> it is up to the application to check the dates, and not the server.
It was my understanding a server should validate the date per type.

> Interestingly, use of date_add() and date_sub() on 'odd' dates such as
> "Feb 31" does produce sane results.
Only partionally ...
  insert into test3 values ( date_add('1996-02-30', interval 0 day) );
  insert into test3 values ( date_add('1996-02-61', interval 0 day) );
  insert into test3 values ( date_add('1996-67-31', interval 0 day) );
  select * from test3;
Returns
  1996-03-01
  NULL         <<< expected: April 1, 1996 ...
  NULL         <<< expected: July 31, 2001 ...

> We may not like the way it works, but at least it's correct per the
manual.
Does it comply to ANSI or SQL92 or ... ??

HansH

...


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to