Hi!

On Thu, Jan 15, 2009 at 12:37 AM, Jay Pipes <[email protected]> wrote:
> see the DATE_FORMAT() function description. If str contains an illegal date,
> time, or datetime value, STR_TO_DATE() returns NULL. An illegal value also
> produces a warning."
>
> I would like to change the above behaviour to throw an error when a string
> is tranformed using the format string argument and the resulting DATE, TIME,
> or DATETIME is not valid.

++

> Also, what should the following return?
>
> SELECT STR_TO_DATE(NULL, '%Y-%m-%d');

IMO, any case where the first argument is NULL and the second argument
is a valid format string should return NULL without a warning.

>
> SELECT STR_TO_DATE(NULL, NULL);

On the fence. NULL is certainly not a valid format string, so I should
say: error.

>
> MySQL returns a NULL value with no warning for both examples:
>
> mysql> SELECT STR_TO_DATE(NULL, '%Y-%m-%d');
> +-------------------------------+
> | STR_TO_DATE(NULL, '%Y-%m-%d') |
> +-------------------------------+
> | NULL                          |
> +-------------------------------+
> 1 row in set (0.00 sec)

I think this is correct. Format string valid, but the value itself
null -> null return

>
> mysql> SELECT STR_TO_DATE(NULL, NULL);
> +-------------------------+
> | STR_TO_DATE(NULL, NULL) |
> +-------------------------+
> | NULL                    |
> +-------------------------+
> 1 row in set (0.00 sec)

I think this should be an error, the format string is not valid.

kind regards,

Roland

>
> Opinions please :)
>
> 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
>



-- 
Roland Bouman
http://rpbouman.blogspot.com/

_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to