diff options
author | unknown <igor@olga.mysql.com> | 2007-07-04 21:12:07 -0700 |
---|---|---|
committer | unknown <igor@olga.mysql.com> | 2007-07-04 21:12:07 -0700 |
commit | 5d88b654ede319aa3534833500f0963eba6f9f1a (patch) | |
tree | eee5240eccde377dd6eef1c7ba965551141fc43b /sql/item.h | |
parent | e2ccd8f8496836a253e7c1621c5d2781d17b18cd (diff) | |
download | mariadb-git-5d88b654ede319aa3534833500f0963eba6f9f1a.tar.gz |
Fixed bug #29392.
This bug may manifest itself for select queries over a multi-table view
that includes an ORDER BY clause in its definition. If the select list of
the query contains references to the same view column with different
aliases the names of the columns in the result output will be nevertheless
the same, coinciding with one of the alias.
The bug happened because the method Item_ref::get_tmp_table_item that
was inherited by the class Item_direct_view_ref ignored the fact that
the name of the view column reference must be inherited by the fields
of the temporary table that was created in order to get the result rows
sorted.
mysql-test/r/view.result:
Added a test case for bug #29392.
mysql-test/t/view.test:
Added a test case for bug #29392.
sql/item.h:
Fixed bug #29392.
This bug may manifest itself for select queries over a multi-table view
that includes an ORDER BY clause in its definition. If the select list of
the query contains references to the same view column with different
aliases the names of the columns in the result output will be nevertheless
the same, coinciding with one of the alias.
The bug happened because the method Item_ref::get_tmp_table_item that
was inherited by the class Item_direct_view_ref ignored the fact that
the name of the view column reference must be inherited by the fields
of the temporary table that was created in order to get the result rows
sorted.
Fixed by providing a proper implementation of the get_tmp_table_item
method for the Item_direct_view_ref class.
Diffstat (limited to 'sql/item.h')
-rw-r--r-- | sql/item.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/item.h b/sql/item.h index 3478095351a..a880f86f601 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1983,6 +1983,12 @@ public: bool fix_fields(THD *, Item **); bool eq(const Item *item, bool binary_cmp) const; + Item *get_tmp_table_item(THD *thd) + { + Item *item= Item_ref::get_tmp_table_item(thd); + item->name= name; + return item; + } virtual Ref_Type ref_type() { return VIEW_REF; } }; |