Hi Victoria,

Victoria Reznichenko wrote:

"Nils Valentin" <[EMAIL PROTECTED]> wrote:


I have a problem understanding why MySQL is deleting a unique key instead of a primary key.

from Documentation: DROP PRIMARY KEY drops the primary index. If no such index exists, it drops the first UNIQUE index in the table.

When I do it then I get this:

mysql> desc uksample4;
+-------+----------+------+-----+---------+-------+
| Field | Type     | Null | Key | Default | Extra |
+-------+----------+------+-----+---------+-------+
| id    | int(11)  |      | UNI | 0       |       |
| name  | char(30) | YES  |     | NULL    |       |
| tel   | char(20) |      | PRI |         |       |
+-------+----------+------+-----+---------+-------+
3 rows in set (0.00 sec)

mysql> alter table uksample4 drop primary key ;
Query OK, 0 rows affected (0.24 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> desc uksample4;
+-------+----------+------+-----+---------+-------+
| Field | Type     | Null | Key | Default | Extra |
+-------+----------+------+-----+---------+-------+
| id    | int(11)  |      |     | 0       |       |
| name  | char(30) | YES  |     | NULL    |       |
| tel   | char(20) |      | PRI |         |       |
+-------+----------+------+-----+---------+-------+
3 rows in set (0.00 sec)

It deletes the unique key (id) instead of he primary key (tel).

Did I do something wrong ?

MySQL 4.0.14



Your example worked fine for me. Could you provide a test case?





I know that the example worked as decribed above, thank you for confirming it. :-)
My Question is, why would it not drop the primary key, but the unique key instead ??


Which command would delete the primary key ?

Best regards

Nils Valentin
Tokyo/Japan



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to