Hi,

this has to be a bug. It seems on windows "RENAME TABLE <old> TO <new>" only
works for uppercase table names _after_ an "ALTER TABLE <old> RENAME AS
<new>" _or_ if you first rename the table using lower case letters:

mysql> create table U1 (id int);
Query OK, 0 rows affected (0.04 sec)

mysql> insert into U1 values (1);
Query OK, 1 row affected (0.01 sec)

mysql> rename table U1 to U2;
ERROR 7: Error on rename of '.\test\u1.MYI' to '.\test\u2.MYI' (Errcode: 13)
mysql> alter table U1 rename as U2;
Query OK, 0 rows affected (0.01 sec)

mysql> rename table U2 to U1;
Query OK, 0 rows affected (0.00 sec)

mysql> rename table U1 to U2;
Query OK, 0 rows affected (0.01 sec)

I think there is some confusion within the mysql server because windows has
case insensitive file names. The table is created with lowercase letters on
the OS level:

mysql> create table W1 (id int);
Query OK, 0 rows affected (0.05 sec)

mysql> insert into W1 values (1);
Query OK, 1 row affected (0.00 sec)

mysql> show tables like "W%";
Empty set (0.01 sec)

mysql> show tables like "w%";
+---------------------+
| Tables_in_test (w%) |
+---------------------+
| w1                  |
+---------------------+
1 rows in set (0.00 sec)

C:\mysql\data\test>dir w1*
 Volume in drive C has no label.
 Volume Serial Number is 28E6-EF3E

 Directory of C:\mysql\data\test

15.02.2002  13:02                8 550 w1.frm
15.02.2002  13:03                    5 w1.MYD
15.02.2002  13:02                1 024 w1.MYI
               3 File(s)          9 579 bytes
               0 Dir(s)     573 779 968 bytes free

mysql> rename table W1 to W2;
ERROR 7: Error on rename of '.\test\w1.MYI' to '.\test\w2.MYI' (Errcode: 13)
mysql> rename table w1 to W2;
Query OK, 0 rows affected (0.01 sec)

mysql> rename table W2 to W1;
Query OK, 0 rows affected (0.00 sec)

mysql> rename table W1 to W2;
Query OK, 0 rows affected (0.01 sec)

Note that the error message has the table name in lower case, so it seems
mysql 'knows' about the OS case insensitivity, but for some reason it fails
on the rename if the user used upper case letters on the RENAME _and_ on the
CREATE, _and_ this is done within the same session. Creating the table,
exiting the mysql console, re-entering the console and then do the rename
works just fine.

--
Roger
query


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to