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 /mysql-test | |
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 'mysql-test')
-rw-r--r-- | mysql-test/r/metadata.result | 11 | ||||
-rw-r--r-- | mysql-test/t/metadata.test | 13 |
2 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/r/metadata.result b/mysql-test/r/metadata.result index 6b498e55d85..2f9fb6b67f5 100644 --- a/mysql-test/r/metadata.result +++ b/mysql-test/r/metadata.result @@ -198,4 +198,15 @@ def IF(i, d, d) IF(i, d, d) 10 10 10 Y 128 0 63 def IFNULL(d, d) IFNULL(d, d) 10 10 10 Y 128 0 63 def LEAST(d, d) LEAST(d, d) 10 10 10 Y 128 0 63 DROP TABLE t1; +# +# Bug#41788 mysql_fetch_field returns org_table == table by a view +# +CREATE TABLE t1 (f1 INT); +CREATE VIEW v1 AS SELECT f1 FROM t1; +SELECT f1 FROM v1 va; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test v1 va f1 f1 3 11 0 Y 32768 0 63 +f1 +DROP VIEW v1; +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/t/metadata.test b/mysql-test/t/metadata.test index a10767579fb..9bfb47c53be 100644 --- a/mysql-test/t/metadata.test +++ b/mysql-test/t/metadata.test @@ -129,4 +129,17 @@ SELECT COALESCE(d, d), IFNULL(d, d), IF(i, d, d), DROP TABLE t1; +--echo # +--echo # Bug#41788 mysql_fetch_field returns org_table == table by a view +--echo # + +CREATE TABLE t1 (f1 INT); +CREATE VIEW v1 AS SELECT f1 FROM t1; +--enable_metadata +SELECT f1 FROM v1 va; +--disable_metadata + +DROP VIEW v1; +DROP TABLE t1; + --echo End of 5.0 tests |