summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@magare.gmz>2007-11-20 19:18:21 +0200
committerunknown <gkodinov/kgeorge@magare.gmz>2007-11-20 19:18:21 +0200
commit870d46819e517ec9dcd7b0e077147c69dbafa929 (patch)
treeb567ffec12a992784efcb1e8e99b2b7d6c19a69f /sql/item.cc
parent86744a32d659463c5cc0b56537c23efe14c480b5 (diff)
downloadmariadb-git-870d46819e517ec9dcd7b0e077147c69dbafa929.tar.gz
Bug #32400: Complex SELECT query returns correct result
only on some occasions Referencing an element from the SELECT list in a WHERE clause is not permitted. The namespace of the WHERE clause is the table columns only. This was not enforced correctly when resolving outer references in sub-queries. Fixed by not allowing references to aliases in a sub-query in WHERE. mysql-test/include/ps_query.inc: Bug #32400: fixed old test queries mysql-test/r/ps_2myisam.result: Bug #32400: fixed old test queries mysql-test/r/ps_3innodb.result: Bug #32400: fixed old test queries mysql-test/r/ps_4heap.result: Bug #32400: fixed old test queries mysql-test/r/ps_5merge.result: Bug #32400: fixed old test queries mysql-test/r/ps_6bdb.result: Bug #32400: fixed old test queries mysql-test/r/ps_7ndb.result: Bug #32400: fixed old test queries mysql-test/r/subselect.result: Bug #32400: test case mysql-test/t/subselect.test: Bug #32400: test case sql/item.cc: Bug #32400: don't allow references to aliases in WHERE tests/mysql_client_test.c: Bug #32400: fixed old test queries
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 431d82af331..3555df40060 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -3641,7 +3641,7 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
}
/* Search in SELECT and GROUP lists of the outer select. */
- if (outer_context->resolve_in_select_list)
+ if (place != IN_WHERE && place != IN_ON)
{
if (!(ref= resolve_ref_in_select_and_group(thd, this, select)))
return -1; /* Some error occurred (e.g. ambiguous names). */