PDA

View Full Version : sql database problems please help


scubadave
4-6-06, 09:28 PM
Hi I loaded a program and use the data base on MySQL 4.0.22-standard the program runs fine. I loaded the same program on MySQL - 4.1.13-log and have issues the problem that I see is on the user tables on MySQL 4.0.22-standard PRIMARY PRIMARY 2 id
id UNIQUE 2 id
id_2 INDEX None id
When i set the same field on MySQL - 4.1.13-log i get this error on the table and it does not work the error reads "PRIMARY and INDEX keys should not both be set for column `id`" any help is truely appreciated
Thanks
Dave

jmucchiello
4-7-06, 02:45 AM
Not sure I understand you problem completely, but basically

CREATE TABLE foo (id INTEGER, ...., PRIMARY (id));

creates both the table and a unique index on id. Thus if your subsequent sql says:

CREATE UNIQUE INDEX ind_foo ON foo (id);

you will get a duplicate index error.

scubadave
4-7-06, 04:28 AM
how can i correct that ? and make the tables work properly?

jmucchiello
4-7-06, 01:33 PM
Actually, you problem looks similar to the problem in this thread: http://forum.powweb.com/showthread.php?t=63814
Perhaps you are using the same package as the fellow in that thread.

The short answer is remove any references to keys and indexes on the (id) column that are outside the primary key statement:

create table foo (id INTEGER, other_col TEXT,..., PRIMARY KEY (id));

All the other "key id_2 (id)" and similar stuff is extraneous.

scubadave
4-7-06, 01:41 PM
I am willing to pay to have this fixed can you do it?