Slim Application Error in file upload OJS 3.3.0.17 with PostgreSQL

Describe the issue or problem
We recently upgraded from OJS 3.1.2.4 to OJS 3.3.0.17, and now it is not possible to upload files, the files that were already uploaded work correctly.

The PHP log shows the following:

Previous error:
Type: PDOException
Code: 42703
Message: SQLSTATE[42703]: Undefined column: 7 ERROR: record «new» does not have a «revision&raquo field;
CONTEXT: SQL statement: «SELECT '<file_id"'||NEW."file_id"||'</file_id"'||'<revision"'||NEW."revision"||'</revision"'&r
quo;
PL/pgSQL function a_i_submission_files_f() on line 1 in assignment
File: OJS\lib\pkp\lib\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOStatement.php
Line: 119
Trace: #0 OJS\lib\pkp\lib\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOStatement.php(119): PDOStatement->execute(NULL)
#1 OJS\lib\pkp\lib\vendor\laravel\framework\src\Illuminate\Database\Connection.php(464): Doctrine\DBAL\Driver\PDOStatement->execute()
#2 OJS\lib\pkp\lib\vendor\laravel\framework\src\Illuminate\Database\Connection.php(664): Illuminate\Database\Connection->Illuminate\Database{closure}(‘insert into "su…’, Array)
#3 OJS\lib\pkp\lib\vendor\laravel\framework\src\Illuminate\Database\Connection.php(631): Illuminate\Database\Connection->runQueryCallback(‘insert into "su…’, Array, Object(Closure))
#4 OJS\lib\pkp\lib\vendor\laravel\framework\src\Illuminate\Database\Connection.php(465): Illuminate\Database\Connection->run(‘insert into "su…’, Array, Object(Closure))
#5 OJS\lib\pkp\lib\vendor\laravel\framework\src\Illuminate\Database\Connection.php(417): Illuminate\Database\Connection->statement(‘insert into "su…’, Array)
#6 OJS\lib\pkp\lib\vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php(2795): Illuminate\Database\Connection->insert(‘insert into "su…’, Array)
#7 OJS\lib\pkp\classes\db\SchemaDAO.inc.php(75): Illuminate\Database\Query\Builder->insert(Array)
#8 OJS\lib\pkp\classes\submission\PKPSubmissionFileDAO.inc.php(91): SchemaDAO->insertObject(Object(SubmissionFile))
#9 OJS\classes\submission\SubmissionFileDAO.inc.php(24): PKPSubmissionFileDAO->insertObject(Object(SubmissionFile))
#10 OJS\lib\pkp\classes\services\PKPSubmissionFileService.inc.php(302): SubmissionFileDAO->insertObject(Object(SubmissionFile))
#11 OJS\lib\pkp\api\v1\submissions\PKPSubmissionFileHandler.inc.php(335): PKP\Services\PKPSubmissionFileService->add(Object(SubmissionFile), Object(Request))
#12 [internal function]: PKPSubmissionFileHandler->add(Object(Slim\Http\Request), Object(APIResponse), Array)
#13 OJS\lib\pkp\lib\vendor\slim\slim\Slim\Handlers\Strategies\RequestResponse.php(40): call_user_func(Array, Object(Slim\Http\Request), Object(APIResponse), Array)
#14 OJS\lib\pkp\lib\vendor\slim\slim\Slim\Route.php(281): Slim\Handlers\Strategies\RequestResponse->__invoke(Array, Object(Slim\Http\Request), Object(APIResponse), Array)
#15 OJS\lib\pkp\lib\vendor\slim\slim\Slim\MiddlewareAwareTrait.php(117): Slim\Route->__invoke(Object(Slim\Http\Request), Object(APIResponse))
#16 OJS\lib\pkp\lib\vendor\slim\slim\Slim\Route.php(268): Slim\Route->callMiddlewareStack(Object(Slim\Http\Request), Object(APIResponse))
#17 OJS\lib\pkp\lib\vendor\slim\slim\Slim\App.php(503): Slim\Route->run(Object(Slim\Http\Request), Object(APIResponse))
#18 OJS\lib\pkp\classes\security\authorization\internal\ApiAuthorizationMiddleware.inc.php(77): Slim\App->__invoke(Object(Slim\Http\Request), Object(APIResponse))
#19 [internal function]: ApiAuthorizationMiddleware->__invoke(Object(Slim\Http\Request), Object(APIResponse), Object(Slim\App))
#20 OJS\lib\pkp\lib\vendor\slim\slim\Slim\DeferredCallable.php(57): call_user_func_array(Object(ApiAuthorizationMiddleware), Array)
#21 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(APIResponse), Object(Slim\App))
#22 OJS\lib\pkp\lib\vendor\slim\slim\Slim\MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(APIResponse), Object(Slim\App))
#23 OJS\lib\pkp\classes\security\authorization\internal\ApiCsrfMiddleware.inc.php(46): Slim\App->Slim{closure}(Object(Slim\Http\Request), Object(APIResponse))
#24 [internal function]: ApiCsrfMiddleware->__invoke(Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#25 OJS\lib\pkp\lib\vendor\slim\slim\Slim\DeferredCallable.php(57): call_user_func_array(Object(ApiCsrfMiddleware), Array)
#26 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#27 OJS\lib\pkp\lib\vendor\slim\slim\Slim\MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#28 OJS\lib\pkp\classes\security\authorization\internal\ApiTokenDecodingMiddleware.inc.php(131): Slim\App->Slim{closure}(Object(Slim\Http\Request), Object(APIResponse))
#29 [internal function]: ApiTokenDecodingMiddleware->__invoke(Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#30 OJS\lib\pkp\lib\vendor\slim\slim\Slim\DeferredCallable.php(57): call_user_func_array(Object(ApiTokenDecodingMiddleware), Array)
#31 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#32 OJS\lib\pkp\lib\vendor\slim\slim\Slim\MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#33 OJS\lib\pkp\classes\handler\APIHandler.inc.php(68): Slim\App->Slim{closure}(Object(Slim\Http\Request), Object(APIResponse))
#34 [internal function]: APIHandler->{closure}(Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#35 OJS\lib\pkp\lib\vendor\slim\slim\Slim\DeferredCallable.php(57): call_user_func_array(Object(Closure), Array)
#36 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#37 OJS\lib\pkp\lib\vendor\slim\slim\Slim\MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#38 OJS\lib\pkp\classes\handler\APIHandler.inc.php(127): Slim\App->Slim{closure}(Object(Slim\Http\Request), Object(APIResponse))
#39 [internal function]: APIHandler->{closure}(Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#40 OJS\lib\pkp\lib\vendor\slim\slim\Slim\DeferredCallable.php(57): call_user_func_array(Object(Closure), Array)
#41 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#42 OJS\lib\pkp\lib\vendor\slim\slim\Slim\MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#43 OJS\lib\pkp\classes\handler\APIHandler.inc.php(132): Slim\App->Slim{closure}(Object(Slim\Http\Request), Object(APIResponse))
#44 [internal function]: APIHandler->{closure}(Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#45 OJS\lib\pkp\lib\vendor\slim\slim\Slim\DeferredCallable.php(57): call_user_func_array(Object(Closure), Array)
#46 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#47 OJS\lib\pkp\lib\vendor\slim\slim\Slim\MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#48 OJS\lib\pkp\lib\vendor\slim\slim\Slim\MiddlewareAwareTrait.php(117): Slim\App->Slim{closure}(Object(Slim\Http\Request), Object(APIResponse))
#49 OJS\lib\pkp\lib\vendor\slim\slim\Slim\App.php(392): Slim\App->callMiddlewareStack(Object(Slim\Http\Request), Object(APIResponse))
#50 OJS\lib\pkp\classes\handler\APIHandler.inc.php(124): Slim\App->process(Object(Slim\Http\Request), Object(APIResponse))
#51 [internal function]: APIHandler->{closure}(Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#52 OJS\lib\pkp\lib\vendor\slim\slim\Slim\DeferredCallable.php(57): call_user_func_array(Object(Closure), Array)
#53 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#54 OJS\lib\pkp\lib\vendor\slim\slim\Slim\MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#55 OJS\lib\pkp\classes\handler\APIHandler.inc.php(132): Slim\App->Slim{closure}(Object(Slim\Http\Request), Object(APIResponse))
#56 [internal function]: APIHandler->{closure}(Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#57 OJS\lib\pkp\lib\vendor\slim\slim\Slim\DeferredCallable.php(57): call_user_func_array(Object(Closure), Array)
#58 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#59 OJS\lib\pkp\lib\vendor\slim\slim\Slim\MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(APIResponse), Object(Closure))
#60 OJS\lib\pkp\lib\vendor\slim\slim\Slim\MiddlewareAwareTrait.php(117): Slim\App->Slim{closure}(Object(Slim\Http\Request), Object(APIResponse))
#61 OJS\lib\pkp\lib\vendor\slim\slim\Slim\App.php(392): Slim\App->callMiddlewareStack(Object(Slim\Http\Request), Object(APIResponse))
#62 OJS\lib\pkp\lib\vendor\slim\slim\Slim\App.php(297): Slim\App->process(Object(Slim\Http\Request), Object(APIResponse))
#63 OJS\lib\pkp\classes\core\APIRouter.inc.php(115): Slim\App->run()
#64 OJS\lib\pkp\classes\core\Dispatcher.inc.php(144): APIRouter->route(Object(Request))
#65 OJS\lib\pkp\classes\core\PKPApplication.inc.php(360): Dispatcher->dispatch(Object(Request))
#66 OJS\index.php(68): PKPApplication->execute()
#67 {main}
View in rendered output by enabling the “displayErrorDetails” setting.

What application are you using?
OJS 3.3.0-17
Postgresql 13

Please could you help me to solve this error.

Hi @Gustavo_Leon,

Do you have any insight into what a_i_submission_files_f is? It’s nothing shipped with OJS. I wonder if this is a custom PL/SQL function.

Regards,
Alec Smecher
Public Knowledge Project Team

We have not made custom postgreSQL functions I thought these functions were created by OJS during installation or upgrade. if I check the function it looks something like this.

CREATE OR REPLACE FUNCTION public.a_i_submission_files_f()
RETURNS trigger
LANGUAGE plpgsql
AS $function$ DECLARE time_mark TIMESTAMP; rec_state INTEGER; pk_d VARCHAR(400); tbl_name VARCHAR(100); BEGIN time_mark = now()+‘1 second’::interval; tbl_name = ‘submission_files’; pk_d = ‘<file_id>’||NEW.“file_id”||‘</file_id>’||‘’||NEW.“revision”||‘’; rec_state = 1; DELETE FROM “public”.“history_store” WHERE table_name = tbl_name AND pk_date_src = pk_d; INSERT INTO “public”.“history_store”( timemark, table_name, pk_date_src, pk_date_dest, record_state ) VALUES (time_mark, tbl_name, pk_d, pk_d, rec_state ); RETURN NEW; END; $function$

I also cannot delete an existing file because of the same function

If I modify the function, the error persists and throws other errors, I did a test by disabling the table triggers and the error seems to go away but I don’t know if this will cause inconsistencies in my database.

Hi @Gustavo_Leon,

Are you using this product/tool?

https://dbconvert.com/blog/bidirectional-database-synchronization/

It appears to be the source of the mystery functions.

Regards,
Alec Smecher
Public Knowledge Project Team

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