Bug #12617 | CREATE TABLE ... SELECT does not respect column order | ||
---|---|---|---|
Submitted: | 17 Aug 2005 8:19 | Modified: | 18 Aug 2005 21:52 |
Reporter: | Carsten Pedersen | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S2 (Serious) |
Version: | 5.0.11 | OS: | Any (all) |
Assigned to: | Evgeny Potemkin | CPU Architecture: | Any |
[17 Aug 2005 8:19]
Carsten Pedersen
[17 Aug 2005 13:37]
MySQL Verification Team
Thank you for the bug report. miguel@hegel:~/dbs/5.0> bin/mysql -uroot test Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 5.0.12-beta-debug Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> drop table if exists t; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> create table t (a tinyint, b tinyint) select (1) as a; Query OK, 1 row affected (0.05 sec) Records: 1 Duplicates: 0 Warnings: 0 mysql> desc t; +-------+------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+------------+------+-----+---------+-------+ | b | tinyint(4) | YES | | NULL | | | a | tinyint(4) | YES | | NULL | | +-------+------------+------+-----+---------+-------+ 2 rows in set (0.01 sec)
[18 Aug 2005 21:52]
Evgeny Potemkin
This behaviour is documented in http://dev.mysql.com/doc/mysql/en/create-table.html "Notice that the columns from the SELECT statement are appended to the right side of the table, not overlapped onto it."