Bug #33657 Falcon: CREATE ... SELECT fails when column name contains quotes
Submitted: 3 Jan 2008 16:36 Modified: 5 May 2008 18:06
Reporter: Philip Stoev Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Falcon storage engine Severity:S3 (Non-critical)
Version:6.0.4-p2 OS:Any
Assigned to: CPU Architecture:Any

[3 Jan 2008 16:36] Philip Stoev
Description:
CREATE ... SELECT fails on Falcon when the SELECT part contains certain expressions.

Innodb works on the same query.

How to repeat:
mysql> create table lll engine=falcon select month("2002-08-02");
ERROR 1005 (HY000): Can't create table 'test.lll' (errno: 156)

create table t1 select date_format("2004-01-19 10:10:10", "%Y-%m-%d");

Suggested fix:
It appears that for the CREATE to fail, there must be a combination of a date function and a string literal argument. Maybe the problem is in the propagation of the result expression all the way to the engine.
[3 Jan 2008 22:29] Philip Stoev
The problem appears to occur if there are quotes in the name of the field, regardless of the function that is used.

mysql> create table t3 engine=falcon select MD5("abcd") as B;
Query OK, 1 row affected (0.03 sec)
Records: 1  Duplicates: 0  Warnings: 0

Possibly similar to bug #33667.

Please note that once table creation fails, no new tables with the same name can ever be created due to bug #32617.
[3 Jan 2008 23:33] Kevin Lewis
See related bug#33667 for an explanation.  If Falcon could do a better job of handling embedded quotes in the function; StorageTableShare::cleanupFieldName() this could be made to work.
[4 Jan 2008 0:01] MySQL Verification Team
Thank you for the bug report.

c:\dbs>5.1\bin\mysql -uroot db5
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 6.0.5-alpha-team-tree-nt Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create table lll engine=falcon select month("2002-08-02");
ERROR 1005 (HY000): Can't create table 'db5.lll' (errno: 156)
[7 Jan 2008 17:17] Jim Starkey
The given example fails in the server due to use of double quotes around 
string literals.  If they are changed to single quotes, the test
cases work.
[25 Feb 2008 19:36] Kevin Lewis
Patch is in mysql-6.0-release version 6.0.4
[5 May 2008 18:06] Paul DuBois
Noted in 6.0.4 changelog.

For table creation, Falcon did not handle identifiers with embedded
double quotes.