OJS 3.0.2: Can't add galley

Hi,
When I click save in the “create galley” dialog, in the production stage for articles, nothing happens. In the error log I get the following.

DB Error: ERROR:  null value in column "file_id" violates not-null constraint\nDETAIL:  Failing row contains (4139, en_US, 3423, null, PDF, 0, , 0)., referer: http://.../workflow/index/3423/5

The editor of the journal tells me this happens for all articles. Is there some prerequisite for adding galleys we have missed, or is this a bug?

Setup: RHEL 7, PHP 5.5.21, Postgres 9.2.18

regards,
Simon

Hi @simonmitternacht,

Hmm, there’s no NOTNULL constraint on the file_id column of submission_galleys in the database XML schema – is this installation upgraded from a previous version? Are you sure the upgrade completed successfully?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi,
This was a multi-step upgrade from 2.3.7 to 3.0.2. There were some postgres-related errors that were fixed, but in the end the upgrade was successful (maybe a few warnings still).

If this column shouldn’t have that constraint, I guess I can change the properties of the table manually.

Thanks!
Simon

Hi again @asmecher,
I altered the table directly in the database, and this seems to have solved the problem. Could there be some postgres-incompatibilities still lingering in the upgrade-scripts that don’t trigger warnings/errors?

Simon

Hi @simonmitternacht,

We depend on ADODB to sync the database schema (in XML) against the actual database – it’s possible that ADODB improperly synced this. Unfortunately that library is (sometimes necessarily) quite a labyrinth so I’m hesitant to dive into debugging it in this case; if you’re able to relax the constraint that was causing you trouble, then proceed, and if you run into anything similar feel free to post here again.

Regards,
Alec Smecher
Public Knowledge Project Team

Ok, thanks @asmecher!

For future reference, the editors managed to publish the whole issue without further problems, so it seems simply altering the table was enough.

I got the same problem after upgrade from 2.4.7-1 to 3.1.0

Hi @Fredrik_Ndjurumana,

Did you try the solution suggested above?

Regards,
Alec Smecher
Public Knowledge Project Team

We upgraded another installation from 2.4.8 to 3.1.0 and I had to do the same fix for that one also, so the problem remains for postgres. The only significant difference in our fork from upstream is the postgres-patch to adodb in pkp-lib discussed elsewhere.

This command solves the issue:

ALTER TABLE submission_galleys ALTER COLUMN file_id DROP NOT NULL;

It would be nice if the error was returned to the frontend, at the moment there is just a spinner that never finishes.

Hi @simonmitternacht,

The error message was caught in the PHP error log, correct? Per http://php.net/manual/fa/errorfunc.configuration.php#ini.display-errors it’s not recommended to bounce system-level error messages to the browser.

Regards,
Alec Smecher
Public Knowledge Project Team

Right, I was thinking of a generic error/error code, instead of the dialog
stalling.

@asmecher : I hit this issue in the middle of a 2.4.8.2 → 3.1.1.4 upgrade (using postgres). In the convertSupplementaryFiles stage:

ojs2: DB Error: ERROR: null value in column “file_id” violates not-null constraint
DETAIL: Failing row contains (7630, en_US, 6196, null, Untitled, 3, RemoteURL, 0)

My analysis is thus: The old database has the NOT NULL attribute on column file_id of the table article_galleys. The upgrade script creates submission_galleys by renaming article_galleys, and that’s how submission_galleys gets to have the NOT NULL attribute too.

The fix is to use
ALTER TABLE article_galleys ALTER COLUMN file_id DROP NOT NULL;
before running the upgrade script. Maybe it can be added to the script.

Brendan.

Hi @bdm,

Hrm, this is actually a bug in the ADODB library we use to handle database schemas. It’s supposed to relax the NOT NULL constraint when it synchronizes the schema XML (dbscripts/xml/ojs_schema.xml in this case).

It’s on our list to update our version of ADODB (it’s currently quite old) and eventually to stop its use entirely. Hopefully the update will fix the bug. In the meantime, your work-around is good.

Thanks,
Alec Smecher
Public Knowledge Project Team

Hi, i´m getting the same error in same versions upgrade with postgre.
Is there any chance to fix it using the
ALTER TABLE article_galleys ALTER COLUMN file_id DROP NOT NULL;
after upgrade is done? Or do i have to upgrade it again?
Regards,
Victor

Hi @vitorio_tito,

Did the upgrade fail, or was it successful? If the upgrade was successful, you should be OK to change this constraint after the upgrade has completed.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi asmecher,
The upgrade was successfully completed. I´ll try to change this constraint and i will tell you.
Thank you for reply.
Victor

It works like a charm! Thank you!
Regards,
Victor

1 Like