A database error has occurred: Duplicate entry 'JQueryPlugin-0-enabled' for key 'plugin_settings_pkey'

No but I can find out. Is there a way to work through this?

Hi @smithmich,

The “right” way to do this is to restore from backup in the case of a failed upgrade, fix the problem, and then run a complete upgrade before continuing. If an upgrade failed some time ago, as I suspect, then I fear that’s likely off the table – you may not have a backup from that point, and if you do, restoring to it will lose any content added since that point.

If you have a copy of the error message that the earlier upgrade attempt failed with, it may be possible to determine where in the upgrade process the script stopped.

Regards,
Alec Smecher
Public Knowledge Project Team

Can you point me to where I would find the error message? Like I mentioned earlier, the upgrade to version 2.3.2 was successful and I could access the site. It is trying to upgrade to 2.4.8 where it is failing.

Hi @smithmich,

A healthy OJS 2.3.2 installation will contain a database table called article_event_log table. The only reason I can think that it wouldn’t, as per the other thread, is if someone tried to upgrade the install to a newer version (which renames/deletes that table), but the upgrade failed, and the site continued to be used in an inconsistent state after the failed upgrade. Is that a possibility?

Regards,
Alec Smecher
Public Knowledge Project Team

I got a copy of the database that had is supposed to be correct and got passed that error. Now I get this error:
A database error has occurred: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’ at line 1. I am running mysql version 5.7.17.

Hi @smithmich,

The lack of context in that error message makes it a little difficult to interpret. One way to get more context is to run the upgrade with the “debug” option turned on; this will cause all DB queries to be dumped as they’re executed, and the last one you see should be the problem query. When re-running a failed upgrade, make sure to restore your database and files area first.

If you’re using the web-based upgrade tool, consider using the command-line one instead. It’ll provide more information.

Regards,
Alec Smecher
Public Knowledge Project Team

When I try to run the upgrade.php I get access denied. I am logged in as root. I was reading similar cases and they suggest clearing the cache. Do you know where the cache is located?

Hi @smithmich,

Hmm, you shouldn’t get an “access denied” if you’re running as root. Could you post a screenshot? I’m not sure this is cache-related.

Regards,
Alec Smecher
Public Knowledge Project Team

This is a screen shot. I’m pretty sure the permissions are correct on the upgrade.php file.

Hi @smithmich,

Try running that from the OJS installation directory, rather than the tools subdirectory. (The tools part is already specified in the first parameter to the php binary.)

Make sure, as always, that you’ve got a good backup of your database and files area, and if you hit a problem, capture the output of the upgrade command so you can post it here.

Regards,
Alec Smecher
Public Knowledge Project Team

OK that worked but I got this output.
[root@OJSServer ojs3]# php tools/upgrade.php upgrade
[pre-install]
[load: upgrade.xml]
[version: 2.4.8.1]
[schema: lib/pkp/xml/schema/signoff.xml]
[data: dbscripts/xml/upgrade/2.3.3_preupdate1.xml]
ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql
ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql
ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql
ERROR: Upgrade failed: DB: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’ at line 1

Hi @smithmich,

Try my earlier suggestion regarding the debug option.

Regards,
Alec Smecher
Public Knowledge Project Team

Which debug options should I turn on and where will the output be?

Hi @smithmich,

The debug option is in the config.inc.php configuration file. While that option is enabled, database queries will be dumped by OJS however it’s executed – either to the website for web-based interaction or on the terminal for terminal-based interaction (as you’re now doing).

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks, I have turned on show_stacktrace and rerun the upgrade.php command. This is the output:
[root@OJSServer ojs3]# php tools/upgrade.php upgrade
[pre-install]
[load: upgrade.xml]
[version: 2.4.8.1]
[schema: lib/pkp/xml/schema/signoff.xml]
[data: dbscripts/xml/upgrade/2.3.3_preupdate1.xml]
ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
File: (unknown) line (unknown)
Function: PKPApplication->errorHandler(2, “assert(): Assertion failed”, “/var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php”, 155, Array(12))
File: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php line 155
Function: assert(False)
File: /var/www/html/ojs3/lib/pkp/classes/install/Installer.inc.php line 396
Function: DBDataXMLParser->parseData(“dbscripts/xml/upgrade/2.3.3_preupdate1.xml”)
File: /var/www/html/ojs3/lib/pkp/classes/install/Installer.inc.php line 269
Function: Installer->executeAction(Array(3))
File: /var/www/html/ojs3/lib/pkp/classes/install/Installer.inc.php line 190
Function: Installer->executeInstaller()
File: /var/www/html/ojs3/lib/pkp/classes/cliTool/UpgradeTool.inc.php line 87
Function: Installer->execute()
File: /var/www/html/ojs3/lib/pkp/classes/cliTool/UpgradeTool.inc.php line 63
Function: UpgradeTool->upgrade()
File: /var/www/html/ojs3/tools/upgrade.php line 34
Function: UpgradeTool->execute()
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql
ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
File: (unknown) line (unknown)
Function: PKPApplication->errorHandler(2, “assert(): Assertion failed”, “/var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php”, 155, Array(12))
File: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php line 155
Function: assert(False)
File: /var/www/html/ojs3/lib/pkp/classes/install/Installer.inc.php line 396
Function: DBDataXMLParser->parseData(“dbscripts/xml/upgrade/2.3.3_preupdate1.xml”)
File: /var/www/html/ojs3/lib/pkp/classes/install/Installer.inc.php line 269
Function: Installer->executeAction(Array(3))
File: /var/www/html/ojs3/lib/pkp/classes/install/Installer.inc.php line 190
Function: Installer->executeInstaller()
File: /var/www/html/ojs3/lib/pkp/classes/cliTool/UpgradeTool.inc.php line 87
Function: Installer->execute()
File: /var/www/html/ojs3/lib/pkp/classes/cliTool/UpgradeTool.inc.php line 63
Function: UpgradeTool->upgrade()
File: /var/www/html/ojs3/tools/upgrade.php line 34
Function: UpgradeTool->execute()
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql
ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
File: (unknown) line (unknown)
Function: PKPApplication->errorHandler(2, “assert(): Assertion failed”, “/var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php”, 155, Array(12))
File: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php line 155
Function: assert(False)
File: /var/www/html/ojs3/lib/pkp/classes/install/Installer.inc.php line 396
Function: DBDataXMLParser->parseData(“dbscripts/xml/upgrade/2.3.3_preupdate1.xml”)
File: /var/www/html/ojs3/lib/pkp/classes/install/Installer.inc.php line 269
Function: Installer->executeAction(Array(3))
File: /var/www/html/ojs3/lib/pkp/classes/install/Installer.inc.php line 190
Function: Installer->executeInstaller()
File: /var/www/html/ojs3/lib/pkp/classes/cliTool/UpgradeTool.inc.php line 87
Function: Installer->execute()
File: /var/www/html/ojs3/lib/pkp/classes/cliTool/UpgradeTool.inc.php line 63
Function: UpgradeTool->upgrade()
File: /var/www/html/ojs3/tools/upgrade.php line 34
Function: UpgradeTool->execute()
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql
ERROR: Upgrade failed: DB: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’ at line 1

Hi @smithmich,

That’s the show_stacktrace option; I was looking for the output from the debug option.

Regards,
Alec Smecher
Public Knowledge Project Team

I set display_errors to On and ran the command. This is the output now.
[root@OJSServer ojs3]# php tools/upgrade.php upgrade
[pre-install]
[load: upgrade.xml]
[version: 2.4.8.1]
[schema: lib/pkp/xml/schema/signoff.xml]
[data: dbscripts/xml/upgrade/2.3.3_preupdate1.xml]
ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql

ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql
ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql

ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql
ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql

ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql
ERROR: Upgrade failed: DB: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’ at line 1

Hi @smithmich,

Sorry, that’s still not the right setting – you need to turn on the debug option. It’s in the [database] section. :slight_smile:

Regards,
Alec Smecher
Public Knowledge Project Team

OK is this what you are looking for?
[root@OJSServer ojs3]# php tools/upgrade.php upgrade

(mysql): SELECT * FROM versions WHERE current = 1


(mysql): SELECT * FROM versions WHERE current = 1 AND product_type = ‘core’ AND product = ‘ojs2’


(mysql): SELECT * FROM versions WHERE current = 1


(mysql): SELECT * FROM versions WHERE current = 1 AND product_type = ‘core’ AND product = ‘ojs2’


(mysql): SELECT * FROM versions WHERE current = 1


(mysql): SELECT * FROM versions WHERE current = 1 AND product_type = ‘core’ AND product = ‘ojs2’


(mysql): SELECT * FROM versions WHERE current = 1


(mysql): SELECT * FROM versions WHERE current = 1 AND product_type = ‘core’ AND product = ‘ojs2’


(mysql): SELECT * FROM versions WHERE current = 1


(mysql): SELECT * FROM versions WHERE current = 1 AND product_type = ‘core’ AND product = ‘ojs2’


(mysql): SELECT * FROM versions WHERE current = 1


(mysql): SELECT * FROM versions WHERE current = 1 AND product_type = ‘core’ AND product = ‘ojs2’

[pre-install]

(mysql): SELECT * FROM versions WHERE current = 1


(mysql): SELECT * FROM versions WHERE current = 1 AND product_type = ‘core’ AND product = ‘ojs2’

[load: upgrade.xml]
[version: 2.4.8.1]
[schema: lib/pkp/xml/schema/signoff.xml]

(mysql): select version()


(mysql): SHOW INDEX FROM signoffs


(mysql): SHOW COLUMNS FROM signoffs


(mysql): SHOW COLUMNS FROM signoffs


(mysql): DROP INDEX signoff_symbolic ON signoffs


(mysql): ALTER TABLE signoffs MODIFY COLUMN signoff_id BIGINT NOT NULL AUTO_INCREMENT


(mysql): ALTER TABLE signoffs MODIFY COLUMN symbolic VARCHAR(32) NOT NULL


(mysql): ALTER TABLE signoffs MODIFY COLUMN assoc_type BIGINT NOT NULL DEFAULT 0


(mysql): ALTER TABLE signoffs MODIFY COLUMN assoc_id BIGINT NOT NULL DEFAULT 0


(mysql): ALTER TABLE signoffs MODIFY COLUMN user_id BIGINT NOT NULL


(mysql): ALTER TABLE signoffs MODIFY COLUMN file_id BIGINT


(mysql): ALTER TABLE signoffs MODIFY COLUMN file_revision BIGINT


(mysql): ALTER TABLE signoffs MODIFY COLUMN date_notified DATETIME


(mysql): ALTER TABLE signoffs MODIFY COLUMN date_underway DATETIME


(mysql): ALTER TABLE signoffs MODIFY COLUMN date_completed DATETIME


(mysql): ALTER TABLE signoffs MODIFY COLUMN date_acknowledged DATETIME


(mysql): ALTER TABLE signoffs MODIFY COLUMN user_group_id BIGINT


(mysql): ALTER TABLE signoffs ADD UNIQUE INDEX signoff_symbolic (assoc_type, assoc_id, symbolic, user_id, user_group_id, file_id, file_revision)

[data: dbscripts/xml/upgrade/2.3.3_preupdate1.xml]

(mysql): SHOW TABLES


(mysql): select version()


(mysql): SHOW COLUMNS FROM review_assignments


(mysql): SHOW COLUMNS FROM review_rounds


(mysql): SHOW COLUMNS FROM comments

ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql
ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql
ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql

(mysql): ALTER TABLE article_notes CHANGE COLUMN article_id assoc_id

1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’ at line 1
ADOConnection._Execute(ALTER TABLE article_notes CHANGE COLUMN article_id assoc_id , false)% line 864, file: /var/www/html/ojs3/lib/pkp/lib/adodb/adodb.inc.php
ADOConnection.Execute(ALTER TABLE article_notes CHANGE COLUMN article_id assoc_id )% line 452, file: /var/www/html/ojs3/lib/pkp/classes/install/Installer.inc.php
Installer.executeSQL(ALTER TABLE article_notes CHANGE COLUMN article_id assoc_id )% line 447, file: /var/www/html/ojs3/lib/pkp/classes/install/Installer.inc.php
Installer.executeSQL(Array[1])% line 447, file: /var/www/html/ojs3/lib/pkp/classes/install/Installer.inc.php
Installer.executeSQL(Array[3])% line 400, file: /var/www/html/ojs3/lib/pkp/classes/install/Installer.inc.php
ERROR: Upgrade failed: DB: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’ at line 1
[root@OJSServer ojs3]#

Hi @smithmich,

Your old installation is still OJS 2.3.2, correct? Can you check whether your article_notes table in the database contains article_id or assoc_id columns?

Regards,
Alec Smecher
Public Knowledge Project Team