On Mon, Jul 15, 2013 at 1:40 PM, Ludo Brands <ludo.bra...@free.fr> wrote: > > Need other default (mis)behaviors for MySQL? > -insert "123test" in an integer field: no error, it inserts 123 > -insert "123test" in a datetime field: no error, it inserts 0000-00-00 > 00:00:00 > -insert 123 in a datetime field: no error, it inserts 2000-01-23 > 00:00:00 . Yes you got that right, inserting integer 11231 translates in > 2001-12-31 00:00:00. 11232 gives 0000-00-00 00:00:00 again. Insert > 11231.133 and you get 2001-12-31 00:00:00 again > -now that you understand the integer to datatime mapping do an UPDATE > table SET date=date+4, you get 2001-12-31 00:00:04. UPDATE table SET > date=date+400 and you obtain 2001-12-31 00:04:04. > -UPDATE table SET date=date*2 results in 0000-00-00 00:00:00. No error. > -more MySQL arithmetic: insert "2001-1+10+3" into a date field: You get > 2001-01-10 03:00:00. "2001-1*10/4^2" results in 2001-01-10 04:02:00 > > Throw anything at it and MySQL will swallow. Your data are in good hands ;) > > Ludo > > --
- Decimals with greater precision than the column don't trigger error, but are rounded instead; - Check constraints are parsed but ignored; - Char columns are not padded in the default configuration; - Char and varchar values that are longer than the column size don't trigger errors in the default configuration; - Varchar values used to be always trimmed before save, not long ago. - Changing a column to "not null" doesn't check existing values. "Toy DB" is almost an overstatement :-/ -Flávio -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus