php - MySQL query on timestamp < 1 stops working after migration -
i have migrated xampp server 1 laptop other (new one). had xampp 64 bit version on old laptop , have installed 32 bit version on new one.
after migration, couldn't pages data out of tables. after debugging, appears following query stopped working:
select * `pages` f_site_id = '1' , deactivation_date < 1; i initialize deactivation_date field value: 0000-00-00 00:00:00.
after changing query above following:
select * `pages` f_site_id = '1' , deactivation_date = '0000-00-00'; it seems working fine again.
can explain why above occurred? there more places have query checks on timestamp < 1 , before replace queries, i'd know why happens.
edit , last query correct way check empty timestamp?
you didn't mention old , new mysql versions, it's hard pin down exactly.
older versions of mysql had sql strict mode, , no_zero_in_date mode, disabled. so, casting small integer date generate valid, if date.
later versions won't that. when try cast small integer date, newer mysql yields null. and, anything < null yields false.
i think that's happened you. time goes mysql , mariadb teams steadily trying rid of datatype sloppiness.
Comments
Post a Comment