Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

ALTER TABLE MODIFY adds duplicate keys

 
   Database Help (Home) -> mySQL RSS
Next:  quick question...  
Author Message
anzenews

External


Since: Feb 16, 2005
Posts: 1



(Msg. 1) Posted: Wed Feb 16, 2005 2:22 pm
Post subject: ALTER TABLE MODIFY adds duplicate keys
Archived from groups: mailing>database>mysql (more info?)

Hello!

I have a weird problem... The application I use issues this SQL from
time to time:

alter table t modify id int(6) unique not null auto_increment;

The problem is that this SQL adds a key on id every time it is run!

mysql> show keys;

+-------+------------+----------+--------------+-------------+--
| Table | Non_unique | Key_name | Seq_in_index | Column_name |
+-------+------------+----------+--------------+-------------+--
| t | 0 | PRIMARY | 1 | id |
| t | 0 | id | 1 | id |
| t | 0 | id_2 | 1 | id |
| t | 0 | id_3 | 1 | id |
| t | 0 | id_4 | 1 | id |
| t | 0 | id_5 | 1 | id |
| t | 0 | id_6 | 1 | id |
| t | 0 | id_7 | 1 | id |
+-------+------------+----------+--------------+-------------+--

(output after 7 runs of the above SQL query)

Is this normal behaviour or is it a bug? I would say it is a bug but I
haven't found anything on the topic on the Internet.
Is there an equivalent SQL that does not create duplicate keys?

I want my application to take care of fields data type and I don't want
to 'know' the current data type - the application should just issue
'alter table modify' query and change data type as appropriate. It all
works well except for this glitch.

The database in question runs very slowly once it has 32 indexes... Sad

Could someone verify this behaviour on MySQL 3.x database?

Any comments are welcome - I could really use some help here.

Thank you!

Anze

 >> Stay informed about: ALTER TABLE MODIFY adds duplicate keys 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
[ANN] ODB C++ ORM 1.6.0 released, adds support for object .. - Hi, I am pleased to announce the release of ODB 1.6.0. ODB is an open-source object-relational mapping (ORM) system for C++. It allows you to persist C++ objects to a relational database without having to deal with tables, columns, or SQL and without..

Create table syntax? - Warning: Error while executing this query:CREATE TABLE "purchaseorder" ( "PurchaseOrderID" int(10) unsigned NOT NULL auto_increment, "PurchaseCost" double unsigned zerofill NOT NULL default '0000000000000000000000', &...

syntax problem for CREATE TABLE ?? - Hi, I was playing with MySQL (4.1.9) during the weekend, but noticed a minor problem and would like someone to explain this to me. Basically I could successfully create a table with one unique column like this: mysql> create table t1 (c1 int....

FLUSH TABLES hangs if table is locked - Using FLUSH TABLES via the C query API mysql_query() hangs if the table is locked already. That is to say, nothing prevents me from running a LOCK TABLES twice; it won't tell me "it's already locked, don't try to run a FLUSH". Anyone know ...

Java mysql show table status - Hi, I am using java to retrieve a resultset with "show table status" mysql command. I am having problem reading the [name] and [engine] column. In the metadata object it is showing as VARCHAR but when I do getString() it is returning me the o...
   Database Help (Home) -> mySQL All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]