Databases: PRIMARY and INDEX keys both set for column "id"

Databases: PRIMARY and INDEX keys both set for column "id"

by Philippe Verdenal -
Number of replies: 2

Hi all,

Moodle 1.5.2+ (2005060222) installed on a Windows server and running really fine...

When editing tables in MySQL Moodle database (phpMyAdmin 2.6.2), I have frequently the following message (see at the bottom of the index structure for mdl_user table):

Indexes: Documentation
KeynameTypeCardinalityActionField
PRIMARY PRIMARY 41  Edit Drop id
id UNIQUE 41  Edit Drop id
username UNIQUE 41  Edit Drop username
user_deleted INDEX Edit Drop deleted
user_confirmed INDEX Edit Drop confirmed
user_firstname INDEX 41  Edit Drop firstname
user_lastname INDEX 41  Edit Drop lastname
user_city INDEX 20  Edit Drop city
user_country INDEX Edit Drop country
user_lastaccess INDEX 41  Edit Drop lastaccess
user_email INDEX 41  Edit Drop email
auth INDEX Edit Drop auth
idnumber INDEX Edit Drop idnumber
Warning PRIMARY and INDEX keys should not both be set for column `id`

Should these keys be modified without causing any database integrity problem?

Thanks for any help,

Cheers.

Average of ratings: -
In reply to Philippe Verdenal

Re: Databases: PRIMARY and INDEX keys both set for column "id"

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Philippe,

Please check Zbigniew's advice in the discussion PRIMARY and INDEX keys both set for "id" Field. You may wish to make a backup of the table before deleting anything.


In reply to Helen Foster

Re: Databases: PRIMARY and INDEX keys both set for column "id"

by Philippe Verdenal -

Good morning Helen,

Thanks for your wise assistance. In fact I started the discussion you did show me, but did not noticed that a solution has been already proposed...

I did backed up the faulty tables, and for the time being, it seems to work OK.

Will come back if anything strange happens...

Thanks again.