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

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

Philippe Verdenal -
回帖数: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.

回复Philippe Verdenal

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

Helen Foster -
Core developers的头像 Documentation writers的头像 Moodle HQ的头像 Particularly helpful Moodlers的头像 Plugin developers的头像 Testers的头像 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.


回复Helen Foster

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

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.