Great fix. When you see how picky I am with stupid details below, you
will know that this is a good fix. I'll tick my mark.
Mattias Jonsson wrote:
> [...]
> === modified file 'mysql-test/t/partition_pruning.test'
> --- a/mysql-test/t/partition_pruning.test 2008-12-28 11:33:49 +0000
> +++ b/mysql-test/t/partition_pruning.test 2009-08-20 20:18:45 +0000
> @@ -9,6 +9,50 @@ drop table if exists t1,t2,t3,t4,t5,t6,t
> --enable_warnings
>
> #
> +# Bug#20577: Partitions: use of to_days() function leads to selection failures
> +#
> +--let $explain_partitions= 0;
>
My advice would to include the EXPLAIN's. This way whoever make changes
that affect plans has to explain why plans change.
> [...]
> === modified file 'sql/item_timefunc.cc'
> [...]
> + if (get_arg0_date(<ime, (TIME_FUZZY_DATE)))
>
Parentheses not really necessery IMHO.
> === modified file 'sql/sql_partition.cc'
> --- a/sql/sql_partition.cc 2009-08-06 12:28:39 +0000
> +++ b/sql/sql_partition.cc 2009-08-20 20:18:45 +0000
> @@ -2766,8 +2766,24 @@ uint32 get_list_array_idx_for_endpoint(p
>
> if (part_info->part_expr->null_value)
> {
> - DBUG_RETURN(0);
> + /*
> + Special handling for MONOTONIC functions that can return NULL for
> + values that is comparable. I.e.
> + '2000-00-00' can be compared to '2000-01-01' but TO_DAYS('2000-00-00')
> + return NULL which cannot be compared used <, >, <=, >= etc.
> +
> + Otherwise, just return the the first index (lowest value).
> + */
>
Minor grammar/spelling:
- values that _are_ comparable. I.e.
- _returns_ NULL which cannot be compared used <, >, <=, >= etc.
> + /*
> + Special handling for MONOTONIC functions that can return NULL for
> + values that is comparable. I.e.
> + '2000-00-00' can be compared to '2000-01-01' but TO_DAYS('2000-00-00')
> + return NULL which cannot be compared used <, >, <=, >= etc.
> +
> + Otherwise, just return the first partition
> + (may be included if not left endpoint)
> + */
>
See above.
That's it!
Best Regards
Martin