Bug #32063 "create table like" works case-significant only in "embedded" server (libmysqld)
Submitted: 2 Nov 2007 21:43 Modified: 18 Dec 2007 4:55
Reporter: Joerg Bruehe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Embedded Library ( libmysqld ) Severity:S3 (Non-critical)
Version:4.1.24 OS:Any
Assigned to: Alexey Botchkov CPU Architecture:Any
Triage: D1 (Critical)

[2 Nov 2007 21:43] Joerg Bruehe
Description:
Found when subjecting the current 4.1 tree to the full tests,
including a run "--embedded-server".

I could produce this behavior in two different installations:
   Linux on x86 (SuSE 9.3,   gcc 3.3.5)
   Linux on PPC (Debian 3.1, gcc 4.1.2)
but it would highly surprise me if this were platform-specific.

Test "lowercase_table" passes in the client/server runs (both "normal" and "PS" protocol),
but fails in an "--embedded-server" run as follows:

=====
lowercase_table                [ fail ]

Errors are (from /MySQL/M41/work-4.1/mysql-test/var/log/mysqltest-time) :
mysqltest: At line 81: query 'create table t2 like T1' failed: 1051: Unknown table 'T1'
(the last lines may be the most important ones)
Result from queries before failure can be found in r/lowercase_table.log
=====

The command sequence in question is:
=====
#
# Bug #9761: CREATE TABLE ... LIKE ... not handled correctly when
# lower_case_table_names is set

create table t1 (a int);
create table t2 like T1;
=====

All other commands using an upper-case name for a table created in lower-case (in this test) worked for all test runs, including "embedded".

How to repeat:
Run tests "embedded".
[10 Nov 2007 12:59] 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/37513

ChangeSet@1.2688, 2007-11-10 16:54:25+04:00, holyfoot@mysql.com +1 -0
  Bug #32063 "create table like" works case-significant only in "embedded" server (libmysqld)
  
  in mysql_creata_like_table() we 'downcase' the complete path to the
  .frm file. It works fine in standalone case as there usually
  we only have './' as a path to the datahome, but doesn't work in
  the embedded server where we add the real path there, so if a
  directory has uppercase letters in it's name, it won't be found.
  
  Fixed by 'downcasing' only database/table pair.
[23 Nov 2007 5:15] Alexander Barkov
The patch http://lists.mysql.com/commits/37513 is ok to push.

P.S.

It will possibly need some tuning when merging to 5.1,
related to "table name to file name encoding".
[14 Dec 2007 8:13] Bugs System
Pushed into 4.1.24
[14 Dec 2007 8:14] Bugs System
Pushed into 5.0.54
[14 Dec 2007 8:17] Bugs System
Pushed into 5.1.23-rc
[14 Dec 2007 8:20] Bugs System
Pushed into 6.0.5-alpha
[18 Dec 2007 4:55] Paul Dubois
Noted in 4.1.24, 5.0.54, 5.1.23, 6.0.5 changelogs.

With lower_case_table_names set, CREATE TABLE LIKE was treated
differently by libmysqld than by the non-embedded server.