Bug #57821 | select columnname,* from tablename failes | ||
---|---|---|---|
Submitted: | 28 Oct 2010 18:12 | Modified: | 19 Aug 2013 15:10 |
Reporter: | Darren Cassar | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server: Parser | Severity: | S3 (Non-critical) |
Version: | 5.1+ | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[28 Oct 2010 18:12]
Darren Cassar
[28 Oct 2010 18:22]
Valeriy Kravchuk
This is easy to verify: macbook-pro:5.5 openxs$ 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 2 Server version: 5.5.7-rc-debug Source distribution Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create table t1 (a int, b char); Query OK, 0 rows affected (0.07 sec) mysql> insert into t1 values (1,'a'); Query OK, 1 row affected (0.00 sec) mysql> select b,* from t1; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* from t1' at line 1 mysql> select b, t1.* from t1; +------+------+------+ | b | a | b | +------+------+------+ | a | 1 | a | +------+------+------+ 1 row in set (0.00 sec) mysql> select *,b from t1; +------+------+------+ | a | b | b | +------+------+------+ | 1 | a | a | +------+------+------+ 1 row in set (0.00 sec) But this is also documented at http://dev.mysql.com/doc/refman/5.1/en/select.html: "Use of an unqualified * with other items in the select list may produce a parse error. To avoid this problem, use a qualified tbl_name.* reference" So, I'd say we have a feature request here.
[19 Aug 2013 15:10]
Gleb Shchepa
This bug is a duplicate of the bug#47127.
[19 Aug 2013 16:08]
Gleb Shchepa
Also see the bug# #41235 (another duplicate).