diff options
author | pem@mysql.com <> | 2006-03-28 14:16:21 +0200 |
---|---|---|
committer | pem@mysql.com <> | 2006-03-28 14:16:21 +0200 |
commit | b310d4fb4d4fb6cf109e95f68192b5532318ae22 (patch) | |
tree | 4eaf09f27405c746d33ea68ed0df4c03acc22ad6 /mysql-test/t | |
parent | 61f2dc713b5ad13cd1ccea4fc38614bfa748199a (diff) | |
download | mariadb-git-b310d4fb4d4fb6cf109e95f68192b5532318ae22.tar.gz |
Post review fixes for BUG#16474: SP crashed MySQL.
Diffstat (limited to 'mysql-test/t')
-rw-r--r-- | mysql-test/t/ps.test | 34 | ||||
-rw-r--r-- | mysql-test/t/sp.test | 5 |
2 files changed, 39 insertions, 0 deletions
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index d6b239c31bf..285b5fb0aa3 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -933,4 +933,38 @@ execute ins_call; select row_count(); drop table t1; +# +# BUG#16474: SP crashed MySQL +# (when using "order by localvar", where 'localvar' is just that. +# The actual bug test is in sp.test, this is just testing that we get the +# expected result for prepared statements too, i.e. place holders work as +# textual substitution. If it's a single integer, it works as the (deprecated) +# "order by column#", otherwise it's an expression. +# +create table t1 (a int, b int); +insert into t1 (a,b) values (2,8),(1,9),(3,7); + +# Will order by index +prepare stmt from "select * from t1 order by ?"; +execute stmt using @a; +set @a=1; +execute stmt using @a; +set @a=2; +execute stmt using @a; +deallocate prepare stmt; +# For reference: +select * from t1 order by 1; + +# Will not order by index. +prepare stmt from "select * from t1 order by ?+1"; +set @a=0; +execute stmt using @a; +set @a=1; +execute stmt using @a; +deallocate prepare stmt; +# For reference: +select * from t1 order by 1+1; + +drop table t1; + # End of 5.0 tests diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index af7ce57b252..1d1272b0b2a 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -5745,6 +5745,11 @@ call bug16474_2(1)| call bug16474_2(2)| drop procedure bug16474_1| drop procedure bug16474_2| + +# For reference: user variables are expressions too and do not affect ordering. +set @x = 2| +select * from t1 order by @x| + delete from t1| |