kgeorge@stripped wrote:
Ok to push after the test case is corrected.
> ChangeSet@stripped, 2007-10-17 18:54:56+03:00, gkodinov@stripped +13 -0
> Bug #31221: Optimizer incorrectly identifies impossible WHERE clause
> No warning was generated when a TIMESTAMP with a non-zero time part
> was converted to a DATE value. This caused index lookup to assume
> that this is a valid conversion and was returning rows that match
> a comparison between a TIMESTAMP value and a DATE keypart.
> Fixed by generating a warning on such a truncation.
>
Queries in the bug report shows different result depending on whether
the index is used or not.
In your test case index is present but isn't used. Please add selects
that shows that the
result is the same.
> +#
> +# Bug #31221: Optimizer incorrectly identifies impossible WHERE clause
> +#
> +
> +CREATE TABLE t1 (a DATE, b INT, PRIMARY KEY (a,b));
> +INSERT INTO t1 VALUES (DATE(NOW()), 1);
> +SELECT COUNT(*) FROM t1 WHERE a = NOW();
> +EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW();
> +INSERT INTO t1 VALUES (DATE(NOW()), 2);
> +SELECT COUNT(*) FROM t1 WHERE a = NOW();
> +EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW();
> +ALTER TABLE t1 DROP PRIMARY KEY;
> +SELECT COUNT(*) FROM t1 WHERE a = NOW();
> +EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW();
> +
> +DROP TABLE t1;
> +
> +
>
--
Evgeny Potemkin, Software Developer
MySQL AB, Moscow, Russia, www.mysql.com
Office:
Are you MySQL certified? www.mysql.com/certification