Bug #58889 ALTER TABLE (PROBLEM)
Submitted: 12 Dec 2010 15:05 Modified: 29 Dec 2010 0:34
Reporter: Benjamin Feliz Mella Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Views Severity:S2 (Serious)
Version:5.1.46-log, 5.0, 5.1 OS:Other (SUSE MySQL RPM)
Assigned to: CPU Architecture:Any
Tags: ALTER TABLE

[12 Dec 2010 15:05] Benjamin Feliz Mella
Description:
Using:
lower_case_table_names=1

ALTER TABLE oldname TO NewName
It alter the Table-Name  but there is no way to touch it later. I mean, using a new name Using Upper characters when database is set to use lower on table names, the ALTER lets rename using upper characters.  

How to repeat:
When lower_case_table_names=1, must use LOWER('NewName')  -before- to ALTER the table name.

Suggested fix:
When lower_case_table_names=1, must use LOWER('NewName')  -before- to ALTER the table name.
[14 Dec 2010 11:01] Susanne Ebrecht
Many thanks for writing a bug report.

Unfortunately, I am not able to follow you here.
What do you think is the bug?
Please describe step by step what you did and where you think we have a bug.
[22 Dec 2010 21:01] Benjamin Feliz Mella
FIRST : 
If you are using lower_case_table_names=1 into init configuration, suppose all tables and databases names became into lower case. 

THEREFORE :
Alter table name must use a lower case function applied to the old name and the new one too in that special case.  

BUT : 
MySQL now is allowing the new name to be set, use Upper and Lower case characters, and the table stay in untouchable state.  SHOW TABLES can show its presence but you can't touch it.

I Think is clear with that, and non require more explanations.

Regards.  Benjamin.
[22 Dec 2010 21:30] Sveta Smirnova
Thank you for the report.

I can not repeat described behavior. Additionally version 5.1.46 is old. Please try current version 5.1.54 and if problem still exists provide your configuration file and copy-paste of queries with results which cause the problem.
[22 Dec 2010 21:54] Benjamin Feliz Mella
Excuse me but i was using a View when my problem occurs.

HOW TO REPRODUCE ERROR:
1)  set lower_case_table_names=1 into my.ini.
2)  startup mysql service and login.
3)  ... create view `old_name` ...
4)  ALTER TABLE `old_name` RENAME TO `New_name`
5)  show tables  (Will show the view with the "New_name")
6)  select * from `New_name`   (Will Report table `new_name` do not exist.)

That its!  

NOTE: In mysql, views are tratted as tables.
[22 Dec 2010 22:30] Sveta Smirnova
Thank you for the report.

Verified as described in versions 5.0 and 5.1

In 5.5 I get error "'ALTER TABLE `oldname` RENAME TO `NewName`' failed: 1347: 'test.oldname' is not BASE TABLE" Looks like it is fixed there.

But as I can not find bug report for this case this one verified for 5.0 and 5.1.
[22 Dec 2010 22:33] Peter Laursen
I have an old (!!!!) report here with similar lower_case_table_names+VIEW problems:
http://bugs.mysql.com/bug.php?id=20356

(but my report is so old now that I really do not remember details - and things may have changed in some respects since).