Post by skidrow » Sat Jun 15, 2024 6:04 am

using:
  • Ubuntu 22.04.03/LTS
  • Apache 2.4.52/FPM
  • PHP 7.4.33
  • MySQL v8.0.37
  • Opencart v3.0.3.8
  • default theme
During upgrade from v3.0.3.8 to v3.0.3.9 I am getting error:

Code: Select all

SyntaxError: Unexpected token '<', "Warning"... is not valid JSON parsererror Warning: mysqli::query(): (23000/1062): Duplicate entry '28-3-1' for key 'oc_product_attribute.PRIMARY' in /var/www/html/opencart3038/public_html/system/library/db/mysqli.php on line 25{"error":"Error Code(0): Error: Duplicate entry '28-3-1' for key 'oc_product_attribute.PRIMARY'
Error No: 1062
ALTER TABLE `oc_product_attribute` ADD PRIMARY KEY(`product_id`,`attribute_id`,`language_id`) in \/var\/www\/html\/opencart3038\/public_html\/system\/library\/db\/mysqli.php on line 49"}
See screenshot #1 below.

I followed the steps in the included UPGRADE markdown file.
As the error shown concerns a SYNTAX error, how to proceed now?

PLEASE NOTE:
  • The error mentions a duplicate key.
  • I like to stress that I started out with a correct populated database w.o. errors.
  • So any errors reported must be caused by the upgrade procedure, especially since the error mentions a SYNTAX error.

Attachments

screenshot #1 - error during upgrade - SyntaxError- Unexpected token.jpg

screenshot #1 - error during upgrade - SyntaxError- Unexpected token.jpg (163.08 KiB) Viewed 3246 times


User avatar
Newbie

Posts

Joined
Wed Dec 19, 2012 1:51 am

Post by nonnedelectari » Sat Jun 15, 2024 8:16 am

skidrow wrote:
Sat Jun 15, 2024 6:04 am
using:
  • Ubuntu 22.04.03/LTS
  • Apache 2.4.52/FPM
  • PHP 7.4.33
  • MySQL v8.0.37
  • Opencart v3.0.3.8
  • default theme
During upgrade from v3.0.3.8 to v3.0.3.9 I am getting error:

Code: Select all

SyntaxError: Unexpected token '<', "Warning"... is not valid JSON parsererror Warning: mysqli::query(): (23000/1062): Duplicate entry '28-3-1' for key 'oc_product_attribute.PRIMARY' in /var/www/html/opencart3038/public_html/system/library/db/mysqli.php on line 25{"error":"Error Code(0): Error: Duplicate entry '28-3-1' for key 'oc_product_attribute.PRIMARY'
Error No: 1062
ALTER TABLE `oc_product_attribute` ADD PRIMARY KEY(`product_id`,`attribute_id`,`language_id`) in \/var\/www\/html\/opencart3038\/public_html\/system\/library\/db\/mysqli.php on line 49"}
See screenshot #1 below.

I followed the steps in the included UPGRADE markdown file.
As the error shown concerns a SYNTAX error, how to proceed now?

PLEASE NOTE:
  • The error mentions a duplicate key.
  • I like to stress that I started out with a correct populated database w.o. errors.
  • So any errors reported must be caused by the upgrade procedure, especially since the error mentions a SYNTAX error.
Ignore the syntax error, it is just because the JS gets an error page back which is not json encoded, an error message on the error message basically.
The real error is that you attempting to add a primary key to the oc_product_attribute table which already has duplicate entries for that key.

Active Member

Posts

Joined
Thu Mar 04, 2021 6:34 pm

Post by skidrow » Thu Jun 20, 2024 5:19 am

Ignoring the JSON part of the error, UPGRADE is reporting a DUPLICATE KEY on an intact and coherent database (see screenshot #4).

This proves that the DUPLICATE KEY error is not caused by an user-generated action and cannot be the cause of the error.

Investigation shows that UPGRADE is failing to ALTER the structure of table:

Code: Select all

oc_product_attribute
This table has a PRIMARY KEY consisting of 4 individual fields (see screenshot #1, #2, #3, and #4).

UPGRADE drops one of the 4 individual fields so that the PRIMARY KEY is now being build from 3 out of the 4 individual fields.
This results in the PRIMARY KEYs no longer being unique what causes the DUPLICATE KEY error (see screenshot #5, #6, and #7).

Please update the UPGRADE procedure of OpenCart v3.0.3.9 to deal with this.

PLEASE NOTE: I uploaded 7 screenshots but only 3 are accepted? This is a technical support forum, isn't?

Attachments

screenshot #3 - describe of table oc_product_attribute before upgrade.jpg

screenshot #3 - describe of table oc_product_attribute before upgrade.jpg (42.34 KiB) Viewed 2962 times

screenshot #2 - show indexes of table oc_product_attribute before upgrade.jpg

screenshot #2 - show indexes of table oc_product_attribute before upgrade.jpg (136.48 KiB) Viewed 2962 times

screenshot #1 - show create of table oc_product_attribute before upgrade.jpg

screenshot #1 - show create of table oc_product_attribute before upgrade.jpg (59.91 KiB) Viewed 2962 times


User avatar
Newbie

Posts

Joined
Wed Dec 19, 2012 1:51 am

Post by ADD Creative » Thu Jun 20, 2024 5:40 am

There isn't a preset_id in the OpenCart oc_product_attribute table, so that's not something that can be fixed. You could however modify your install/opencart.sql to match the changes made to your database.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by Jaesin » Thu Jun 20, 2024 12:48 pm

Dont mean to derail this, but I cam here for a similar concern.... in my 3038 to 3039 upgrade...
My error is the following while trying to upgrade....

SyntaxError: Unexpected token '<', "Warning"... is not valid JSON parsererror Warning: mysqli::query(): (HY000/1283): Column 'description' cannot be part of FULLTEXT index in /var/www/vhosts/mydomain.com/httpdocs/system/library/db/mysqli.php on line 25{"error":"Error Code(0): Error: Column 'description' cannot be part of FULLTEXT index
Error No: 1283
ALTER TABLE `oc_product_description` CHANGE `name` `name` VARCHAR(255) NOT NULL AFTER `language_id` in \/var\/www\/vhosts\/mydomain.com\/httpdocs\/system\/library\/db\/mysqli.php on line 49"}


Should I start a different question thread?

Thx

New member

Posts

Joined
Wed Aug 23, 2017 11:31 pm

Post by ADD Creative » Thu Jun 20, 2024 4:12 pm

Jaesin wrote:
Thu Jun 20, 2024 12:48 pm
Dont mean to derail this, but I cam here for a similar concern.... in my 3038 to 3039 upgrade...
My error is the following while trying to upgrade....

SyntaxError: Unexpected token '<', "Warning"... is not valid JSON parsererror Warning: mysqli::query(): (HY000/1283): Column 'description' cannot be part of FULLTEXT index in /var/www/vhosts/mydomain.com/httpdocs/system/library/db/mysqli.php on line 25{"error":"Error Code(0): Error: Column 'description' cannot be part of FULLTEXT index
Error No: 1283
ALTER TABLE `oc_product_description` CHANGE `name` `name` VARCHAR(255) NOT NULL AFTER `language_id` in \/var\/www\/vhosts\/mydomain.com\/httpdocs\/system\/library\/db\/mysqli.php on line 49"}


Should I start a different question thread?

Thx
It probably better to start you own topic. However, your issue is similar in that something has changed you database tables and added FULLTEXT to the description column of the oc_product_description table. OpenCart does not use FULLTEXT in any tables.

There are no major changes to the database between 3.0.3.8 and 3.0.3.9, so you are probably safe skipping the upgrade script.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom
Who is online

Users browsing this forum: No registered users and 6 guests