diff options
author | unknown <pem@mysql.com> | 2006-03-10 14:04:56 +0100 |
---|---|---|
committer | unknown <pem@mysql.com> | 2006-03-10 14:04:56 +0100 |
commit | fb36d923cea32705dff7d5221234ce948b13c17a (patch) | |
tree | 4e96b6ad4a1bf804a4ab0a7d332758b98d341f1c /mysql-test | |
parent | e889f9efcc0e5c9583001321a1dbd31b2ba5c371 (diff) | |
download | mariadb-git-fb36d923cea32705dff7d5221234ce948b13c17a.tar.gz |
Fixed BUG#16474: SP crashed MySQL
fix_fields() was not called for "order by" variables if the type was a
"constant integer", and thus interpreted as a column index.
However, a local variable is an expression and should not be interpreted
as a column index. Instead it behaves just like when using a user variable
for instance (i.e. it will not affect the ordering).
mysql-test/r/sp.result:
Updated results for new test case (BUG#16474).
mysql-test/t/sp.test:
New test case for BUG#16474.
sql/sql_select.cc:
When processing order list,
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/sp.result | 29 | ||||
-rw-r--r-- | mysql-test/t/sp.test | 31 |
2 files changed, 60 insertions, 0 deletions
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index b03c49b72e7..f19dbbd2689 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -4857,4 +4857,33 @@ i 0 drop table t3| drop procedure bug16887| +drop procedure if exists bug16474_1| +drop procedure if exists bug16474_2| +delete from t1| +insert into t1 values ('c', 2), ('b', 3), ('a', 1)| +create procedure bug16474_1() +begin +declare x int; +select id from t1 order by x; +end| +create procedure bug16474_2(x int) +select id from t1 order by x| +call bug16474_1()| +id +c +b +a +call bug16474_2(1)| +id +c +b +a +call bug16474_2(2)| +id +c +b +a +drop procedure bug16474_1| +drop procedure bug16474_2| +delete from t1| drop table t1,t2; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index e6823693b3d..af7ce57b252 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -5718,6 +5718,37 @@ drop procedure bug16887| # +# BUG#16474: SP crashed MySQL +# (when using "order by localvar", where 'localvar' is just that. +# +--disable_warnings +drop procedure if exists bug16474_1| +drop procedure if exists bug16474_2| +--enable_warnings + +delete from t1| +insert into t1 values ('c', 2), ('b', 3), ('a', 1)| + +create procedure bug16474_1() +begin + declare x int; + + select id from t1 order by x; +end| + +# This does NOT order by column index; variable is an expression. +create procedure bug16474_2(x int) + select id from t1 order by x| + +call bug16474_1()| +call bug16474_2(1)| +call bug16474_2(2)| +drop procedure bug16474_1| +drop procedure bug16474_2| +delete from t1| + + +# # BUG#NNNN: New bug synopsis # #--disable_warnings |