summaryrefslogtreecommitdiff
path: root/mysql-test/t/row.test
diff options
context:
space:
mode:
authorunknown <gshchepa/uchum@gshchepa.loc>2007-04-20 15:14:09 +0500
committerunknown <gshchepa/uchum@gshchepa.loc>2007-04-20 15:14:09 +0500
commita8f639fccc19ef80d67c52e698bf6366fdcf6f94 (patch)
tree6383a76b0ed8fd01a6c60da7807976b0f22d3f6f /mysql-test/t/row.test
parent78c734b0132fbd53ff033eada5a9664919370739 (diff)
downloadmariadb-git-a8f639fccc19ef80d67c52e698bf6366fdcf6f94.tar.gz
Bug#27704: incorrect comparison of rows with NULL components
Support for NULL components was incomplete for row comparison, fixed. Added support for abort_on_null at compare_row() like in 5.x sql/item_cmpfunc.h: Bug#27704: incorrect comparison of rows with NULL components Added support for abort_on_null at Item_bool_func2 like in 5.x sql/item_cmpfunc.cc: Bug#27704: incorrect comparison of rows with NULL components Support for NULL components was incomplete for row comparison, fixed. Added support for abort_on_null at compare_row() like in 5.x mysql-test/t/row.test: Test case updated for Bug#27704 (incorrect comparison of rows with NULL components) mysql-test/r/row.result: Test case updated for Bug#27704 (incorrect comparison of rows with NULL components) mysql-test/r/subselect.result: Test case updated for Bug#27704 (incorrect comparison of rows with NULL components)
Diffstat (limited to 'mysql-test/t/row.test')
-rw-r--r--mysql-test/t/row.test45
1 files changed, 45 insertions, 0 deletions
diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test
index 6c66d45b942..6f845607d8c 100644
--- a/mysql-test/t/row.test
+++ b/mysql-test/t/row.test
@@ -108,4 +108,49 @@ SELECT ROW(2,1) IN (ROW(21,2),ROW(ROW(1,1,3),0));
--error 1241
SELECT ROW(2,1) IN (ROW(ROW(1,1,3),0),ROW(21,2));
+#
+# Bug#27704: erroneous comparison of rows with NULL components
+#
+CREATE TABLE t1(a int, b int, c int);
+INSERT INTO t1 VALUES (1, 2, 3),
+ (NULL, 2, 3 ), (1, NULL, 3 ), (1, 2, NULL),
+ (NULL, 2, 3+1), (1, NULL, 3+1), (1, 2+1, NULL),
+ (NULL, 2, 3-1), (1, NULL, 3-1), (1, 2-1, NULL);
+
+SELECT (1,2,3) = (1, NULL, 3);
+SELECT (1,2,3) = (1+1, NULL, 3);
+SELECT (1,2,3) = (1, NULL, 3+1);
+SELECT * FROM t1 WHERE (a,b,c) = (1,2,3);
+
+SELECT (1,2,3) <> (1, NULL, 3);
+SELECT (1,2,3) <> (1+1, NULL, 3);
+SELECT (1,2,3) <> (1, NULL, 3+1);
+SELECT * FROM t1 WHERE (a,b,c) <> (1,2,3);
+
+SELECT (1,2,3) < (NULL, 2, 3);
+SELECT (1,2,3) < (1, NULL, 3);
+SELECT (1,2,3) < (1-1, NULL, 3);
+SELECT (1,2,3) < (1+1, NULL, 3);
+SELECT * FROM t1 WHERE (a,b,c) < (1,2,3);
+
+SELECT (1,2,3) <= (NULL, 2, 3);
+SELECT (1,2,3) <= (1, NULL, 3);
+SELECT (1,2,3) <= (1-1, NULL, 3);
+SELECT (1,2,3) <= (1+1, NULL, 3);
+SELECT * FROM t1 WHERE (a,b,c) <= (1,2,3);
+
+SELECT (1,2,3) > (NULL, 2, 3);
+SELECT (1,2,3) > (1, NULL, 3);
+SELECT (1,2,3) > (1-1, NULL, 3);
+SELECT (1,2,3) > (1+1, NULL, 3);
+SELECT * FROM t1 WHERE (a,b,c) > (1,2,3);
+
+SELECT (1,2,3) >= (NULL, 2, 3);
+SELECT (1,2,3) >= (1, NULL, 3);
+SELECT (1,2,3) >= (1-1, NULL, 3);
+SELECT (1,2,3) >= (1+1, NULL, 3);
+SELECT * FROM t1 WHERE (a,b,c) >= (1,2,3);
+
+DROP TABLE t1;
+
# End of 4.1 tests