maria-discuss team mailing list archive
-
maria-discuss team
-
Mailing list archive
-
Message #01208
Re: warning 1292
Hi, Federico!
On Dec 11, Federico Razzoli wrote:
> Hi! MySQL 5.6 returns a warning for wrong datatypes, with any SQL_MODE:
>
> mysql> CREATE TABLE t (c TIMESTAMP) ENGINE=InnoDB;
> Query OK, 0 rows affected (0,31 sec)
>
> mysql> SELECT c FROM t WHERE c = 1;
> Empty set, 1 warning (0,00 sec)
> Warning (Code 1292): Incorrect datetime value: '1' for column 'c' at row 1
>
> Will this be done in MariaDB 10 too? Currently, no warning is issued.
This is intentional. You get a warning if you do, for example
INSERT t VALUES (1);
because in this case a decimal value 1 is converted into a TIMESTAMP.
But for comparison purposes you only need to know whether c is equal to
1 or not. You did not request any conversion, you only asked the server
whether these values are equal. Thus you should not expect any warnings
either.
Regards,
Sergei
Follow ups
References