Post by jrr » Tue Mar 16, 2021 12:44 pm

I was rummaging around the DB just looking it over as I'd had some trouble with searches when I found that oc_product_description had two primary keys!

These are found in product_id and language_id when one looks at the structure under phpMyAdmin. Note I am running php 7.3.x, and my collation is utf8mb4_unicode_ci.

I understood that two primary keys was not supposed to exist in a DB so I tried a totally fresh locahost install and yup, there it is again in oc_product_description.

I haven't turned up any reference to this in a few searches so I figured I'd post it here. Everythign I see says you can't have two primary keys in one table so either phpMyAdmin is reporting some other key for language_id as a second primary key or OC has a slight issue here...

I now see there are many tables with two or more primary keys. I thought using more than one primary key in a table was a bad idea but perhaps I am reading the wrong information. Can someone enlighten me please?

Last edited by jrr on Wed Mar 17, 2021 12:49 am, edited 1 time in total.

Active Member


Mon Nov 20, 2017 1:48 pm

Post by kestas » Tue Mar 16, 2021 5:04 pm

You can have multiple primary keys. They will enforce unique values, and will speed up querying of those values. ... ate%20keys.

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here

Active Member


Tue Oct 12, 2010 2:23 am

Post by JNeuhoff » Tue Mar 16, 2021 6:58 pm

It's correct. Its primary key consists of 2 indexes to make it unique: product_id and language_id

Override Engine * Integrated VQMod * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Rich Snippets * Google Tag Manager * Export/Import Tool * SpamBot Buster * Survey Plus

User avatar
Expert Member


Wed Dec 05, 2007 3:38 am

Who is online

Users browsing this forum: No registered users and 8 guests