diff options
author | serg@serg.mylan <> | 2004-05-17 11:04:12 +0200 |
---|---|---|
committer | serg@serg.mylan <> | 2004-05-17 11:04:12 +0200 |
commit | bc71d98a039d80cf0281f8745933f3e75a4f376a (patch) | |
tree | d73198dde21335dba2533b1b1906050dd572d46a | |
parent | 0dc8aacf7dab5eca9b9b90cc24c6da3c9d45515a (diff) | |
download | mariadb-git-bc71d98a039d80cf0281f8745933f3e75a4f376a.tar.gz |
bug#3681 - order by, distinct, refer to aliased field by name
check for field_name (not only for name) in find_item_in_list, to be compatible with item->eq() that is done later
-rw-r--r-- | mysql-test/r/order_by.result | 4 | ||||
-rw-r--r-- | sql/sql_base.cc | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 5edffdacc98..694dc26bcde 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -89,10 +89,10 @@ create table t1 ( pk int primary key, name varchar(255) not null, number v insert into t1 values (1, 'Gamma', '123'), (2, 'Gamma Ext', '123a'), (3, 'Alpha', '001'), (4, 'Beta', '200c'); select distinct t1.name as 'Building Name',t1.number as 'Building Number' from t1 order by t1.name asc; Building Name Building Number -Gamma 123 -Gamma Ext 123a Alpha 001 Beta 200c +Gamma 123 +Gamma Ext 123a drop table t1; create table t1 (id int not null,col1 int not null,col2 int not null,index(col1)); insert into t1 values(1,2,2),(2,2,1),(3,1,2),(4,1,1),(5,1,4),(6,2,3),(7,3,1),(8,2,4); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 14a54a410a2..e3fbfb2d0e3 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2103,7 +2103,9 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter, => we have to check presence of name before compare */ if (item_field->name && - !my_strcasecmp(system_charset_info, item_field->name, field_name)) + (!my_strcasecmp(system_charset_info, item_field->name, field_name) || + !my_strcasecmp(system_charset_info, + item_field->field_name, field_name))) { if (!table_name) { |