I have Joomla 3.8.5 stable version. The code I am tring to execute is: Pastebin SQL code (I am tring to install the JOMESTATE plugin)

I get the following error:

JInstaller: :Install: Error SQL Multiple primary key defined Extension Install: SQL error processing query: DB function failed with error number 1068 Multiple primary key defined.


ALTER TABLE `#__cddir_jomestate`
ADD KEY `fk_#__cddir_content_#__categories` (`categories_id`), 
ADD KEY `fk_#__cddir_content_#__users1` (`users_id`), 
ADD KEY `fk_#__cddir_content_#__assets1` (`asset_id`), 
ADD KEY `categories_address_id` (`categories_address_id`), 
ADD KEY `categories_type_id` (`categories_type_id`), 
ADD KEY `title` (`title`), 
ADD KEY `company_id` (`company_id`), 
ADD KEY `access` (`access`), 
ADD KEY `fulladdress` (`fulladdress`), 
ADD KEY `published` (`published`), 
ADD KEY `approved` (`approved`);

Any idea?

  • 1
    Perhaps you intend to set a UNIQUE CONSTRAINT. can you explain your coding intentions? It is okay to set composite keys. Do you need multiple PRIMARY KEYs to be established? Commented Aug 7, 2018 at 15:44

2 Answers 2


(Your question might get a better answer on the main stackexchange site, since it's really a SQL question/issue more than a Joomla one.)

I'd look at what the primary key of that table is now. If one exists, drop/remove it, and then try the query again. If the current primary key IS id already, you could instead remove ADD PRIMARY KEY (id), from your query.

Before you do any of that you should back up the table (in case stuff hits the fan).

  • I did not write the cose. I have bought the extension. By the way I tried to look up in my DB but i did not find any table called __cddir_jomestate. So I gess that it is obvius that an ALTER TABLE istruction, executed on a table that does not exist is gonna generate errors. But maybe everything has been roled back after detecting the error.
    – Bog Alt
    Commented Mar 8, 2018 at 14:21
  • I'm a little confused, are you installing via the normal package installer and getting that error, or are you attempting to execute those SQL queries yourself on your database? If the latter, why?
    – Drew G
    Commented Mar 8, 2018 at 14:40
  • Normal: Extension -> manager -> install
    – Bog Alt
    Commented Mar 8, 2018 at 15:19

This code causes the issue:

ALTER TABLE `#__cddir_jomestate`
ADD PRIMARY KEY (`id`), <- this line

Remove the line; it's totally unnecessary. Do the same for the other ALTER TABLE commands if necessary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.