Publication_id cannot be nulled

Hello sir. I got this error while run upgrade from version 3.2.1.4 to 3.3.0.3

[data: dbscripts/xml/upgrade/3.2.0_versioning.xml] ERROR: Upgrade failed: DB: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'publication_id' cannot be null (SQL: UPDATE publication_formats as pf SET publication_id = ( SELECT s.current_publication_id FROM temp_publication_formats as tpf LEFT JOIN submissions as s ON (tpf.submission_id = s.submission_id) WHERE pf.publication_format_id = tpf.publication_format_id ) )

So can you share hpw to fix this issue?

Hi @fairuz,

Other users have reported this error on the forum when upgrading. Hereā€™s one example:

Try searching ā€œPublication_id Null Upgradeā€ on the forum and youā€™ll see a number of other relevant results that offer suggestions for what to try when facing this issue.

Best regards,

Roger
PKP Team

I am following documentations using command line
php tools/upgrade.php upgrade

But the process stuck on as screenshot below. I am restore back previous database .And retry command line above. Still stuck.
Screenshot 2021-03-04 at 12.13.26 AM

PS : Upgrade from 3.1.2.4 to 3.3.x.x

Hi @fairuz,

Did you try the solution on the thread linked above? After restoring the backup and before running the upgrade script, what do you get for the following database query?

SELECT pf.publication_id FROM publication_formats pf LEFT JOIN submissions s ON (pf.publication_id = s.submission_id) WHERE s.submission_id IS NULL;

Regards,
Alec Smecher
Public Knowledge Project Team

Did you try the solution on the thread linked above? >> YES

After restoring the backup and before running the upgrade script, what do you get for the following database query?
SELECT pf.publication_id FROM publication_formats pf LEFT JOIN submissions s ON (pf.publication_id = s.submission_id) WHERE s.submission_id IS NULL;

Results >>1054 - Unknown column ā€˜pf.publication_idā€™ in ā€˜field listā€™,

Hi @fairuz,

Can you confirm whether your OMP 3.2.1-4 database (before attempting the upgrade to 3.3) has a column called publication_id in the publication_formats table? This should definitely be present.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

Here is my publications_formats table before upgrade to OMP 3.3.x.x. No column called publication_id inside this table.

Screenshot 2021-07-07 at 3.26.21 PM

Hi @fairuz,

Then something has happened outside of OMP 3.2.1 to remove that column from your database. Either the column was removed manually, or perhaps you attempted to run an upgrade to 3.3.x that completed partially but failed. In order to upgrade from 3.2.1 to 3.3.x you need a clean database, i.e. one that has not already failed an attempted upgrade.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher and @fairuz

Same problem here.
Iā€™m trying to upgrade from version 3.1.0.0 to the latest one (3.3.0-7).
Should I upgrade to version 3.2.X before try 3.3.X?

Regards,
Tarcisio Pereira

Hi @asmecher, @fairuz and @rcgillis

DELETE FROM publication_formats WHERE publication_format_id in (SELECT pf.publication_format_id FROM publication_formats pf LEFT JOIN submissions s ON (pf.submission_id = s.submission_id) WHERE s.submission_id IS NULL);

I run this query before update.
Works for me!

Regards,
Tarcisio Pereira.

2 Likes

This topic was automatically closed after 7 days. New replies are no longer allowed.