diff options
author | Sergey Glukhov <Sergey.Glukhov@sun.com> | 2010-03-12 10:33:16 +0400 |
---|---|---|
committer | Sergey Glukhov <Sergey.Glukhov@sun.com> | 2010-03-12 10:33:16 +0400 |
commit | b8132a8d946bde553834c37785bbe53008f1e925 (patch) | |
tree | 8c5e7ceda5785c052e709a71c6a64f50b2e93eae /sql/item.h | |
parent | b182c9bd2030c3b3c548157d1bc4c01c306b2c5c (diff) | |
download | mariadb-git-b8132a8d946bde553834c37785bbe53008f1e925.tar.gz |
Bug#41788 mysql_fetch_field returns org_table == table by a view
The problem is that Item_direct_view_ref which is inherited
from Item_ident updates orig_table_name and table_name with
the same values. The fix is introduction of new constructor
into Item_ident and up which updates orig_table_name and
table_name separately.
mysql-test/r/metadata.result:
test case
mysql-test/t/metadata.test:
test case
sql/item.cc:
new constructor which updates
orig_table_name and table_name
separately.
sql/item.h:
new constructor which updates
orig_table_name and table_name
separately.
sql/table.cc:
used new constructor
Diffstat (limited to 'sql/item.h')
-rw-r--r-- | sql/item.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sql/item.h b/sql/item.h index d2e8382023b..77b6e28e98b 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1402,6 +1402,7 @@ public: const char *db_name_arg, const char *table_name_arg, const char *field_name_arg); Item_ident(THD *thd, Item_ident *item); + Item_ident(TABLE_LIST *view_arg, const char *field_name_arg); const char *full_name() const; void cleanup(); bool remove_dependence_processor(uchar * arg); @@ -2222,6 +2223,8 @@ public: Item_ref(Name_resolution_context *context_arg, Item **item, const char *table_name_arg, const char *field_name_arg, bool alias_name_used_arg= FALSE); + Item_ref(TABLE_LIST *view_arg, Item **item, + const char *field_name_arg, bool alias_name_used_arg= FALSE); /* Constructor need to process subselect with temporary tables (see Item) */ Item_ref(THD *thd, Item_ref *item) @@ -2337,6 +2340,12 @@ public: {} /* Constructor need to process subselect with temporary tables (see Item) */ Item_direct_ref(THD *thd, Item_direct_ref *item) : Item_ref(thd, item) {} + Item_direct_ref(TABLE_LIST *view_arg, Item **item, + const char *field_name_arg, + bool alias_name_used_arg= FALSE) + :Item_ref(view_arg, item, field_name_arg, + alias_name_used_arg) + {} double val_real(); longlong val_int(); @@ -2362,6 +2371,10 @@ public: /* Constructor need to process subselect with temporary tables (see Item) */ Item_direct_view_ref(THD *thd, Item_direct_ref *item) :Item_direct_ref(thd, item) {} + Item_direct_view_ref(TABLE_LIST *view_arg, Item **item, + const char *field_name_arg) + :Item_direct_ref(view_arg, item, field_name_arg) + {} bool fix_fields(THD *, Item **); bool eq(const Item *item, bool binary_cmp) const; |