From 1f57bfb8d1ed7f4cbe4a3410752903106cc8d34c Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 23 Nov 2007 16:30:06 +0400 Subject: Fix for bug #32560: crash with interval function and count(*) Problem: INTERVAL function implementation doesn't handle NULL range values. Fix: skip NULL ranges looking for a proper one. mysql-test/r/func_set.result: Fix for bug #32560: crash with interval function and count(*) - test result. mysql-test/t/func_set.test: Fix for bug #32560: crash with interval function and count(*) - test case. sql/item_cmpfunc.cc: Fix for bug #32560: crash with interval function and count(*) - skip NULL ranges calculating INTERVAL(...). --- mysql-test/t/func_set.test | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'mysql-test/t/func_set.test') diff --git a/mysql-test/t/func_set.test b/mysql-test/t/func_set.test index 710b9b90a05..e4fde6e0e0e 100644 --- a/mysql-test/t/func_set.test +++ b/mysql-test/t/func_set.test @@ -54,4 +54,21 @@ select find_in_set(binary 'a', 'A,B,C'); # select find_in_set('1','3,1,'); -# End of 4.1 tests +--echo End of 4.1 tests + +# +# Bug #32560: crash with interval function and count(*) +# +SELECT INTERVAL(0.0, NULL); +SELECT INTERVAL(0.0, CAST(NULL AS DECIMAL)); +SELECT INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL)); +SELECT INTERVAL(0.0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +SELECT INTERVAL(0.0, CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), + CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), + CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL)); +SELECT INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL), + CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL), + CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL), + CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL)); + +--echo End of 5.0 tests -- cgit v1.2.1