Bug #25930 CREATE TABLE x SELECT ... parses columns wrong when ran with ANSI_QUOTES mode
Submitted: 29 Jan 2007 21:35 Modified: 31 Aug 2007 1:47
Reporter: Tobias Asplund Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Parser Severity:S3 (Non-critical)
Version:5.0.33, 4.1 BK, 5.1 BK OS:Linux (Linux)
Assigned to: Marc ALFF CPU Architecture:Any

[29 Jan 2007 21:35] Tobias Asplund
Description:
Query somehow includes a double quote in column name when running in ANSI_QUOTES in a combination with CREATE TABLE...SELECT...

(Thanks Pavel Pushkarev for finding this)

How to repeat:
mysql> SET SQL_MODE = 'ANSI_QUOTES';
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TABLE t1 ( "blah" INT );
Query OK, 0 rows affected (0.34 sec)

mysql> CREATE TABLE t2 SELECT "blah" - 1 FROM t1;
Query OK, 0 rows affected (0.12 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> desc t2;
+-----------+------------+------+-----+---------+-------+
| Field     | Type       | Null | Key | Default | Extra |
+-----------+------------+------+-----+---------+-------+
| blah" - 1 | bigint(12) | YES  |     | NULL    |       | 
+-----------+------------+------+-----+---------+-------+
1 row in set (0.06 sec)
[30 Jan 2007 9:01] Sveta Smirnova
test case

Attachment: bug25930.test (application/octet-stream, text), 278 bytes.

[30 Jan 2007 9:02] Sveta Smirnova
Thank you for the report.

Verified as described on Linux using last BK sources.
[9 Aug 2007 23:31] 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/32340

ChangeSet@1.2563, 2007-08-09 17:31:00-06:00, malff@weblab.(none) +2 -0
  Bug#25930 (CREATE TABLE x SELECT ... parses columns wrong when ran with
             ANSI_QUOTES mode)
  
  This patch contains a test case only, showing that the bug has been fixed.
  
  The issue was related to parsing <"blah">, where the lexical analyser
  would not properly delimit the start and end of the token.
  
  Properly making the token boundaries has been fixed in sql_lex.cc
  with the patch for bug 25411 : see the Lex_input_stream class.
[21 Aug 2007 23:21] Bugs System
Pushed into 5.1.22-beta
[27 Aug 2007 13:07] Paul DuBois
Pushed to 5.1.23, not 5.1.22.
[31 Aug 2007 1:47] Paul DuBois
No changelog entry needed. This report involves a test case only.