summaryrefslogtreecommitdiff
path: root/mysql-test/r/func_set.result
diff options
context:
space:
mode:
authorJorgen Loland <jorgen.loland@oracle.com>2011-03-04 15:46:17 +0100
committerJorgen Loland <jorgen.loland@oracle.com>2011-03-04 15:46:17 +0100
commit4015719c01c679544d47f4a788756128d9c34b93 (patch)
treed344171eb27cd61a824d74c757654e16caf999bb /mysql-test/r/func_set.result
parenta4711099716c53490a69c3c17a8b61a4a3282b19 (diff)
downloadmariadb-git-4015719c01c679544d47f4a788756128d9c34b93.tar.gz
BUG#11766317: FIND_IN_SET won't work normaly after upgrade
from 5.1 to 5.5 (Former 59405) In this bug, args[0] in an Item_func_find_in_set stored an Item_func_weekday that was constant. In Item_func_find_in_set::fix_length_and_dec(), args[0]->val_str() was called. Later, when Item_func_find_in_set::val_int() was called, args[0]->null_value was checked. However, the Item_func_weekday in args[0] had now been replaced with an Item_cache. No val_*() calls had been made to this Item_cache, thus null_value was incorrectly 'true', resulting in missing rows in the result set. enum_value gets a value in fix_length_and_dec() iff args[0] is both constant and non-null. It is therefore unnecessary to check the null_value of args[0] in val_int(). An alternative fix would be to call args[0]->val_int() inside Item_func_find_in_set::val_int(). This would ensure args[0]->null_value was set correctly (always false in this case), but that would have to be done for every record this const value is checked against. mysql-test/r/func_set.result: Add test for BUG#59405 mysql-test/t/func_set.test: Add test for BUG#59405
Diffstat (limited to 'mysql-test/r/func_set.result')
-rw-r--r--mysql-test/r/func_set.result42
1 files changed, 42 insertions, 0 deletions
diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result
index 14ebc8203ec..ba9500bff46 100644
--- a/mysql-test/r/func_set.result
+++ b/mysql-test/r/func_set.result
@@ -159,3 +159,45 @@ SELECT CONVERT( a USING latin1 ) FROM t2;
CONVERT( a USING latin1 )
DROP TABLE t1, t2;
+#
+# BUG#59405: FIND_IN_SET won't work normaly after upgrade from 5.1 to 5.5
+#
+CREATE TABLE t1(days set('1','2','3','4','5','6','7'));
+INSERT INTO t1 VALUES('1,2,3,4,5,6,7'), (NULL), ('1,2,3,4,5,6,7');
+
+SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), days);
+days
+1,2,3,4,5,6,7
+1,2,3,4,5,6,7
+SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), days) IS UNKNOWN;
+days
+NULL
+SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), NULL);
+days
+SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), NULL) IS UNKNOWN;
+days
+1,2,3,4,5,6,7
+NULL
+1,2,3,4,5,6,7
+SELECT * FROM t1 WHERE FIND_IN_SET(7, days);
+days
+1,2,3,4,5,6,7
+1,2,3,4,5,6,7
+SELECT * FROM t1 WHERE FIND_IN_SET(8, days);
+days
+SELECT * FROM t1 WHERE FIND_IN_SET(NULL, days);
+days
+SELECT * FROM t1 WHERE FIND_IN_SET(NULL, days) IS UNKNOWN;
+days
+1,2,3,4,5,6,7
+NULL
+1,2,3,4,5,6,7
+SELECT * FROM t1 WHERE FIND_IN_SET(NULL, NULL);
+days
+SELECT * FROM t1 WHERE FIND_IN_SET(NULL, NULL) IS UNKNOWN;
+days
+1,2,3,4,5,6,7
+NULL
+1,2,3,4,5,6,7
+
+DROP TABLE t1;