summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2001-12-27 02:04:27 +0200
committerunknown <monty@hundin.mysql.fi>2001-12-27 02:04:27 +0200
commitaa3bce07ab8a832656b0f56fdf5ad9ac1aaa90e9 (patch)
tree06bd9771a6953cb6da8a5f98d2b29b06e564806b /mysql-test
parent42c224c388452598ca1539325b53bf4ebaccb682 (diff)
downloadmariadb-git-aa3bce07ab8a832656b0f56fdf5ad9ac1aaa90e9.tar.gz
Bugfix for WHERE key=@a OR key=@b
Docs/manual.texi: Changelog sql/sql_select.cc: Cleanup
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/variables.result11
-rw-r--r--mysql-test/t/variables.test13
2 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index f852378e6a1..ab60d5042b0 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -12,3 +12,14 @@ NULL NULL NULL NULL
5 5 1 4
@t5
1.23456
+@min_cid:=min(c_id) @max_cid:=max(c_id)
+1 4
+c_id c_name c_country
+1 Bozo USA
+4 Mr. Floppy GB
+c_id c_name c_country
+1 Bozo USA
+4 Mr. Floppy GB
+c_id c_name c_country
+1 Bozo USA
+4 Mr. Floppy GB
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index d5ff64d199b..0499263467c 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -1,6 +1,7 @@
#
# test variables
#
+drop table if exists t1;
set @`test`=1,@TEST=3,@select=2,@t5=1.23456;
select @test,@`select`,@TEST,@not_used;
set @test_int=10,@test_double=1e-10,@test_string="abcdeghi",@test_string2="abcdefghij",@select=NULL;
@@ -14,3 +15,15 @@ select @test_int,@test_double,@test_string,@test_string2;
select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
select @t5;
+#
+# Test problem with WHERE and variables
+#
+
+CREATE TABLE t1 (c_id INT(4) NOT NULL, c_name CHAR(20), c_country CHAR(3), PRIMARY KEY(c_id));
+INSERT INTO t1 VALUES (1,'Bozo','USA'),(2,'Ronald','USA'),(3,'Kinko','IRE'),(4,'Mr. Floppy','GB');
+SELECT @min_cid:=min(c_id), @max_cid:=max(c_id) from t1;
+SELECT * FROM t1 WHERE c_id=@min_cid OR c_id=@max_cid;
+SELECT * FROM t1 WHERE c_id=@min_cid OR c_id=@max_cid OR c_id=666;
+ALTER TABLE t1 DROP PRIMARY KEY;
+select * from t1 where c_id=@min_cid OR c_id=@max_cid;
+drop table t1;