Galleys list does not appear. OJS 3.2.0-3 with Postgres

Hi,
When I intend to finish the submission process and schedule for publication, I cannot send the final file because the Galleys list does not appear.

Capturar6

Httpd log:

PHP Fatal error:  Uncaught Error: Call to a member function getFileId() on null in /var/www/ojs-3.2.0-3/lib/pkp/controllers/api/file/linkAction/FileLinkAction.inc.php:46\nStack trace:\n#0 /var/www/ojs-3.2.0-3/lib/pkp/controllers/api/file/linkAction/DownloadFileLinkAction.inc.php(37): FileLinkAction->getActionArgs(NULL, 5)\n#1 /var/www/ojs-3.2.0-3/controllers/grid/articleGalleys/ArticleGalleyGridCellProvider.inc.php(90): DownloadFileLinkAction->__construct(Object(Request), NULL, 5, 'PDF')\n#2 /var/www/ojs-3.2.0-3/lib/pkp/classes/controllers/grid/GridCellProvider.inc.php(56): ArticleGalleyGridCellProvider->getCellActions(Object(Request), Object(ArticleGalleyGridRow), Object(GridColumn))\n#3 /var/www/ojs-3.2.0-3/lib/pkp/classes/controllers/grid/GridHandler.inc.php(1104): GridCellProvider->render(Object(Request), Object(ArticleGalleyGridRow), Object(GridColumn))\n#4 /var/www/ojs-3.2.0-3/lib/pkp/classes/controllers/grid/GridHandler.inc.php(1011): GridHandler->_renderCellInternally(Object(Request), Object(ArticleGalleyGridRow), Object(Gri in /var/www/ojs-3.2.0-3/lib/pkp/controllers/api/file/linkAction/FileLinkAction.inc.php on line 46, referer: http://ojs2-testes.ufes.br/argumentum/workflow/index/29070/5

Please, help me.

Hi @asmecher,
my friend @diegojmacedo found that for some reason the value of the file_id column of publication_galleys that references the file_id of the submission_files table does not exist.

So, I ran a sql to see what records this situation happened:

select publication_id from public.publication_galleys
where file_id not in (select file_id from submission_files);

:point_right:(6794,6795,9533,13869,15796,18004,6151,3853,6745,6788,6797,8100,15225)

If we put file_id = null in the submission_galleys table for these records, the Galleys list appears again normally. But investigating the situation of publications, we find the following situation:

SELECT submission_id FROM public.publications where publication_id in
(6794,6795,9533,13869,15796,18004,6151,3853,6745,6788,6797,8100,15225);

:point_right:('18384','19032','21669','5229','7848','8518','8572','8578','8579','8581','10079','11730','16737')

SELECT * FROM public.publication_galleys where publication_id  in 
(6794,6795,9533,13869,15796,18004,6151,3853,6745,6788,6797,8100,15225) order by file_id;

:point_right:('10607','18473','20933','21027','21043','21045','21049','24654','31071','46124','51775','54039','62770')

SELECT * FROM public.submission_files where submission_id in (
'18384','19032','21669','5229','7848','8518','8572','8578','8579','8581','10079','11730','16737') order by file_id;  

:point_right:('10608','10609','18474','20934','21028','21044','21046','21050','24655','31072','46125','51776','54040','54040','54376','62771')

It is as if the file counter added one more:
(‘10607’ :point_right: ‘10608’,‘10609’)
(‘18473’ :point_right: ‘18474’)

What worries me if it happens for all records or if only for those.