Bug #35428 When selecting from INFORMATION_SCHEMA tables, incomplete metadata
Submitted: 19 Mar 2008 8:41 Modified: 12 Nov 2009 19:21
Reporter: Konstantin Osipov (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Information schema Severity:S3 (Non-critical)
Version:5.0.56, 5.1.23-rc OS:Any
Assigned to: Sergei Glukhov CPU Architecture:Any

[19 Mar 2008 8:41] Konstantin Osipov
Description:
When I query information_schema tables, columns of the result set that refer to information_schema table columns have incomplete metadata.

In particular, "Database" column is not set. It should be "INFORMATION_SCHEMA":

mysql> select distinct information_schema.tables.table_name from information_schema.tables limit 1;
Field   1:  `table_name`
Catalog:    `def`
Database:   ``
Table:      `tables`
Org_table:  ``
Type:       VAR_STRING
Collation:  latin1_swedish_ci (8)
Length:     64
Max_length: 14
Decimals:   0
Flags:      NOT_NULL 

+----------------+
| table_name     |
+----------------+
| CHARACTER_SETS | 
+----------------+
1 row in set (0.00 sec)

Compare with a query against a "real" database:
mysql> select t1.a from test.t1;
Field   1:  `a`
Catalog:    `def`
Database:   `test`
Table:      `t1`
Org_table:  `t1`
Type:       LONG
Collation:  binary (63)
Length:     11
Max_length: 1
Decimals:   0
Flags:      NUM 

+------+
| a    |
+------+
|    1 | 
+------+
1 row in set (0.02 sec)

How to repeat:
Issue any query against an INFORMATION_SCHEMA table.

Suggested fix:
Fill in "INFORMATION_SCHEMA" in Database: property of result set metadata.
[19 Mar 2008 9:04] Valeriy Kravchuk
Thank you for a bug report.
[27 Mar 2008 14:58] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/44517

ChangeSet@1.2602, 2008-03-27 18:48:03+04:00, gluh@mysql.com +8 -0
  Bug#35428 When selecting from INFORMATION_SCHEMA tables, incomplete metadata
  added intialization of db name for I_S table fields
  added intialization of orig table name for I_S table fields
[4 Apr 2008 9:42] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/44900

ChangeSet@1.2599, 2008-04-04 14:30:53+05:00, gluh@mysql.com +8 -0
  Bug#35428 When selecting from INFORMATION_SCHEMA tables, incomplete metadata
  added intialization of db name for I_S table fields
  added intialization of orig table name for I_S table fields
[18 Dec 2008 16:52] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/61988

2823 Sergey Glukhov	2008-12-18
      Bug#35428 When selecting from INFORMATION_SCHEMA tables, incomplete metadata
      added intialization of db name for I_S table fields
      added intialization of orig table name for I_S table fields
[20 Jan 2009 18:53] Bugs System
Pushed into 6.0.10-alpha (revid:joro@sun.com-20090119171328-2hemf2ndc1dxl0et) (version source revid:azundris@mysql.com-20081230114916-c290n83z25wkt6e4) (merge vers: 6.0.9-alpha) (pib:6)
[6 Feb 2009 20:23] Paul DuBois
Noted in 6.0.10 changelog.

Result set metadata for columns retrieved from INFORMATION_SCHEMA 
tables did not have the db or org_table members of the MYSQL_FIELD
structure set.
[23 Oct 2009 10:18] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/87914

2917 Sergey Glukhov	2009-10-23
      Bug#35428 When selecting from INFORMATION_SCHEMA tables, incomplete metadata
      backport to Betony
     @ mysql-test/r/information_schema.result
        Bug#35428 When selecting from INFORMATION_SCHEMA tables, incomplete metadata
        backport to Betony
     @ mysql-test/r/show_check.result
        Bug#35428 When selecting from INFORMATION_SCHEMA tables, incomplete metadata
        backport to Betony
     @ mysql-test/t/information_schema.test
        Bug#35428 When selecting from INFORMATION_SCHEMA tables, incomplete metadata
        backport to Betony
     @ sql/field.cc
        Bug#35428 When selecting from INFORMATION_SCHEMA tables, incomplete metadata
        backport to Betony
     @ sql/sql_base.cc
        Bug#35428 When selecting from INFORMATION_SCHEMA tables, incomplete metadata
        backport to Betony
     @ sql/sql_handler.cc
        Bug#35428 When selecting from INFORMATION_SCHEMA tables, incomplete metadata
        backport to Betony
     @ sql/sql_select.cc
        Bug#35428 When selecting from INFORMATION_SCHEMA tables, incomplete metadata
        backport to Betony
     @ sql/table.cc
        Bug#35428 When selecting from INFORMATION_SCHEMA tables, incomplete metadata
        backport to Betony
     @ tests/mysql_client_test.c
        Bug#35428 When selecting from INFORMATION_SCHEMA tables, incomplete metadata
        backport to Betony
[31 Oct 2009 8:18] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20091031081410-qkxmjsdzjmj840aq) (version source revid:lars-erik.bjork@sun.com-20091023144402-05x9kn8fz878z011) (merge vers: 6.0.14-alpha) (pib:13)
[31 Oct 2009 17:45] Paul DuBois
Already fixed in earlier 6.0.x.

Setting report to NDI pending push to 5.5.x.
[12 Nov 2009 8:16] Bugs System
Pushed into 5.5.0-beta (revid:alik@sun.com-20091110093229-0bh5hix780cyeicl) (version source revid:mikael@mysql.com-20091102100915-a2nbfxaqprpgptfw) (merge vers: 5.5.0-beta) (pib:13)
[12 Nov 2009 19:21] Paul DuBois
Noted in 5.5.0 changelog.