DB: ERROR: null value in column "subject" violates not-null constraint

Hi,
during the upgrade from OJS 2.4.6 to 2.4.8 (postgres db)
I had this error
[pre-install]
[load: upgrade.xml]
[version: 2.4.8.0]
[schema: lib/pkp/xml/schema/signoff.xml]
[schema: lib/pkp/xml/schema/common.xml]
ERROR: Upgrade failed: DB: ERROR: null value in column “subject” violates not-null constraint

I recently upgraded other ojs instances with no error to the same version.

I tried to drop in the DB that column for the table email_templates_data and then launch the upgrade but the error was still there.

How can I solve?

thanks,
andrea

Hi @marchitelli,

If you drop the column before running the upgrade, then ADODB (which OJS uses for managing database schemas) will try to add the column including its NOT NULL constraint – but because there’s no default, you’ll get the message you describe.

I would suggest restoring your database so that the subject column is present, then checking to see if any of the rows in it have an empty subject.

Regards,
Alec Smecher
Public Knowledge Project Team

In wich tables should I see?
Thanks

Hi @marchitelli,

That would be useful information :slight_smile:

Try:

  • email_templates_data
  • email_templates_default_data

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher, thankl you for the suggestions

I found and corrected the null value that was
select *
FROM email_templates_default_data
WHERE locale=‘da_DK’
AND email_key=‘OFR_REVIEW_REMINDER_LATE’

Hi @marchitelli,

I’ve filed that for attention: da_DK email template OFR_REVIEW_REMINDER_LATE contains empty subject · Issue #1544 · pkp/pkp-lib · GitHub

For the moment, I’d suggest entering a temporary subject for that email message. That should solve the upgrade problem.

Regards,
Alec Smecher
Public Knowledge Project Team