Error when updating from 3.1.2-4 to 3.2.0-1 with postgres

Hi @asmecher,
we are progressing.
Now, I encountered the following error:

Blockquote [code: Installer Installer::installEmailTemplate]

[code: Installer Installer::changeUserRolesAndStageAssignmentsForStagePermitSubmissionEdit]
[data: dbscripts/xml/upgrade/3.2.0_versioning.xml]
ERROR: Upgrade failed: DB: ERROR: null value in column “setting_type” violates not-null constraint
DETALHE: Failing row contains (47515, , country, , null).
You have new mail in /var/spool/mail/root

Another similar error,
I found it early in the update:

[data: dbscripts/xml/upgrade/3.2.0_archiving_settings.xml]
[data: dbscripts/xml/upgrade/3.2.0_update.xml]
ERROR: Upgrade failed: DB: ERROR: null value in column “email_id” violates not-null constraint
DETALHE: Failing row contains (null, pt_BR, subject, Avaliação da edição de texto concluída).
You have new mail in /var/spool/mail/root

I noticed that in the \var\www\ojs-3.2.0-1\dbscripts\xml\upgrade\3.2.0_preupdate_email_templates.xml file,
on line 34, for some reason it was not running properly, I think.

UPDATE email_templates_data SET email_id=email_templates.email_id FROM email_templates WHERE email_templates_data.email_key = email_templates.email_key AND email_templates_data.assoc_type = email_templates.assoc_type AND email_templates_data.assoc_id = email_templates.assoc_id

So, I analyzed the keys for each line and made a command for each email_id, like this:

UPDATE email_templates_data SET email_id = 7 WHERE email_templates_data.email_key = ‘REVIEW_REQUEST’ AND email_templates_data.assoc_id = 20 ; COMMIT;

Then, after starting the installation, I manually run this script to fill in the entire email_id column.
What could also be done to improve this?