ERROR!
I have always hated the way MySQL has taken strings like 1232STRING as a
number. Leads to tons of stupid errors hidden deep in applications.
/David
On Thu, 2009-01-08 at 16:29 -0500, Jay Pipes wrote:
> All:
>
> mysql> SELECT FROM_UNIXTIME("2008-01-08 03:14:07");
> +--------------------------------------+
> | FROM_UNIXTIME("2008-01-08 03:14:07") |
> +--------------------------------------+
> | 1969-12-31 19:33:28 |
> +--------------------------------------+
> 1 row in set, 1 warning (0.00 sec)
>
> mysql> show warnings;
> +---------+------+----------------------------------------------------------+
> | Level | Code | Message
> |
> +---------+------+----------------------------------------------------------+
> | Warning | 1292 | Truncated incorrect INTEGER value: '2008-01-08
> 03:14:07' |
> +---------+------+----------------------------------------------------------+
> 1 row in set (0.00 sec)
>
> I was actually surprised to find this was the behaviour in MySQL and
> Drizzle.
>
> Would anyone have a problem if I converted the above to an error?
> FROM_UNIXTIME() only takes unsigned integers in the range of 0 to
> INT32_MAX. It doesn't take strings, or strings that "look like
> numbers", or anything of the sort.
>
> IMHO, the above behaviour is dangerous, as it:
>
> * Implicitly tries to convert a string to an integer (based on the warning)
> * Produces an invalid TIMESTAMP value
> * Doesn't error, therefore giving the unassuming user the impression
> that FROM_UNIXTIME() indeed takes string parameters.
>
> Anyone object to me making the above an error?
>
> Cheers,
>
> Jay
>
> _______________________________________________
> Mailing list: https://launchpad.net/~drizzle-discuss
> Post to : [email protected]
> Unsubscribe : https://launchpad.net/~drizzle-discuss
> More help : https://help.launchpad.net/ListHelp
_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help : https://help.launchpad.net/ListHelp