summaryrefslogtreecommitdiff
path: root/mysql-test/r/order_by.result
diff options
context:
space:
mode:
authorunknown <dlenev@brandersnatch.localdomain>2004-09-30 16:28:17 +0400
committerunknown <dlenev@brandersnatch.localdomain>2004-09-30 16:28:17 +0400
commit53edc92cd01c292ebe536070f11c311542c7bb95 (patch)
tree869403a16f8b3c117fed13dae2bac7e2f7ab89b6 /mysql-test/r/order_by.result
parentccf52b4fd5bd7ae0a418d22f2758cef345b6afa6 (diff)
downloadmariadb-git-53edc92cd01c292ebe536070f11c311542c7bb95.tar.gz
Final solution for bug# 4302 "Ambiguos order by when renamed column is
identical to another in result" According to SQL standard queries like "select t1.a as col from t1, t2 order by a" should return an error if both tables contain field a. mysql-test/r/order_by.result: Updated test to conform SQL-standard. mysql-test/t/order_by.test: Updated test to conform SQL-standard. sql/item.cc: find_item_in_list() has now one more out parameter which is not used in item.cc functions. sql/mysql_priv.h: find_item_in_list(): Added boolean out parameter "unaliased" which indicates that we have found field by its original name and not by its alias in item (select) list. sql/sql_base.cc: find_item_in_list(): Added boolean out parameter "unaliased" which indicates that we have found field by its original name and not by its alias in item (select) list. This means that additional check is required to ensure there will be no ambiguity if we would search for this field in all tables. sql/sql_select.cc: find_order_in_list(): If we have found field in select list by its original name and not by its alias then we should perform additional check to ensure that there will be no ambiguity if we will search for this field in all tables. Also small cleanup.
Diffstat (limited to 'mysql-test/r/order_by.result')
-rw-r--r--mysql-test/r/order_by.result9
1 files changed, 3 insertions, 6 deletions
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index 69ce69ad499..94d56bbc2fa 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -680,6 +680,9 @@ order by col;
ERROR 23000: Column 'col' in order clause is ambiguous
select col1 from t1, t2 where t1.col1=t2.col2 order by col;
ERROR 23000: Column 'col' in order clause is ambiguous
+select t1.col as t1_col, t2.col2 from t1, t2 where t1.col1=t2.col2
+order by col;
+ERROR 23000: Column 'col' in order clause is ambiguous
select t1.col as t1_col, t2.col from t1, t2 where t1.col1=t2.col2
order by col;
t1_col col
@@ -696,12 +699,6 @@ col col2
1 3
2 2
3 1
-select t1.col as t1_col, t2.col2 from t1, t2 where t1.col1=t2.col2
-order by col;
-t1_col col2
-1 1
-2 2
-3 3
select t2.col2, t2.col, t2.col from t2 order by col;
col2 col col
3 1 1