Bug #79641 | COM_QUERY Response metadata with '*' in field org_table | ||
---|---|---|---|
Submitted: | 14 Dec 2015 17:37 | Modified: | 25 Oct 2016 15:31 |
Reporter: | Filipe Silva | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
Version: | 5.7.10 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[14 Dec 2015 17:37]
Filipe Silva
[14 Dec 2015 17:47]
MySQL Verification Team
btw, you don't need packet traces to see this. client has an option... E:\mysql-5.7.10-winx64\bin>mysql -root test -P3307 --column-type-info Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 12 Server version: 5.7.10 MySQL Community Server (GPL) Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> CREATE TABLE tbl (c CHAR(1)); Query OK, 0 rows affected (0.01 sec) mysql> INSERT INTO tbl VALUES ('A'); Query OK, 1 row affected (0.00 sec) mysql> SELECT * FROM (SELECT c FROM tbl) T; Field 1: `c` Catalog: `def` Database: `test` Table: `T` Org_table: `*` Type: STRING Collation: cp850_general_ci (4) Length: 1 Max_length: 1 Decimals: 0 Flags: +------+ | c | +------+ | A | +------+ 1 row in set (0.00 sec)
[14 Dec 2015 17:52]
Filipe Silva
Nice :). Didn't know that, thanks!
[25 Oct 2016 15:31]
Paul DuBois
Posted by developer: Noted in 5.7.17, 8.0.1 changelogs. In the MYSQL_FIELD C API structure, the org_table value for derived tables was *, which could cause failure for queries that depend on this value. The org_table value for views and derived tables now is set as follows: If the column is selected from a view, org_table names the view. If the column is selected from a derived table, org_table names the base table. If a derived table wraps a view, org_table still names the base table. If the column is an expression, org_table is the empty string.