0

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.

SQL =

ALTER TABLE `#__cddir_jomestate`
ADD PRIMARY KEY (`id`), 
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? – mickmackusa Aug 7 '18 at 15:44
1

(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 Mar 8 '18 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 Mar 8 '18 at 14:40
  • Normal: Extension -> manager -> install – Bog Alt Mar 8 '18 at 15:19
1

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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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