diff options
author | unknown <igor@olga.mysql.com> | 2007-01-10 00:27:11 -0800 |
---|---|---|
committer | unknown <igor@olga.mysql.com> | 2007-01-10 00:27:11 -0800 |
commit | 6fc17dab1ec371ca2849a6df8661b5420d1cb255 (patch) | |
tree | ce7c35c4bbf327fcd8e1c81681d199433b1eec9f /mysql-test/t/order_by.test | |
parent | 8e0eea0d336fe259a753ebc380bc85cf31b29599 (diff) | |
download | mariadb-git-6fc17dab1ec371ca2849a6df8661b5420d1cb255.tar.gz |
Fixed bug #25427.
In the method Item_field::fix_fields we try to resolve the name of
the field against the names of the aliases that occur in the select
list. This is done by a call of the function find_item_in_list.
When this function finds several occurrences of the field name
it sends an error message to the error queue and returns 0.
Yet the code did not take into account that find_item_in_list
could return 0 and tried to dereference the returned value.
mysql-test/r/order_by.result:
Added a test case for bug #25427.
mysql-test/t/order_by.test:
Added a test case for bug #25427.
sql/item.cc:
Fixed bug #25427.
In the method Item_field::fix_fields we try to resolve the name of
the field against the names of the aliases that occur in the select
list. This is done by a call of the function find_item_in_list.
When this function finds several occurrences of the field name
it sends an error message to the error queue and returns 0.
Yet the code did not take into account that find_item_in_list
could return 0 and tried to dereference the returned value.
Diffstat (limited to 'mysql-test/t/order_by.test')
-rw-r--r-- | mysql-test/t/order_by.test | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index a8024be7032..3c23ea76d99 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -575,4 +575,19 @@ SELECT a + 1 AS num, (select num + 2 FROM t1 LIMIT 1) FROM t1; SELECT a.a + 1 AS num FROM t1 a JOIN t1 b ON num = b.a; DROP TABLE t1; +# +# Bug #25427: crash when order by expression contains a name +# that cannot be resolved unambiguously +# + +CREATE TABLE t1 (a int); + +SELECT p.a AS val, q.a AS val1 FROM t1 p, t1 q ORDER BY val > 1; +--error 1052 +SELECT p.a AS val, q.a AS val FROM t1 p, t1 q ORDER BY val; +--error 1052 +SELECT p.a AS val, q.a AS val FROM t1 p, t1 q ORDER BY val > 1; + +DROP TABLE t1; + # End of 4.1 tests |