psql crash when running a procedure with an inout parameter and a commit - Mailing list pgsql-bugs

From Chuck Nellis
Subject psql crash when running a procedure with an inout parameter and a commit
Date
Msg-id BN1P110MB0579207C8864B99CE3367722A7FD9@BN1P110MB0579.NAMP110.PROD.OUTLOOK.COM
Whole thread Raw
Responses Re: psql crash when running a procedure with an inout parameter and a commit  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs

PostgreSQL folks,

 

I’d like to report a bug I encountered while running psql on PostgreSQL version 12.5, on RHEL 7.9.   I decomposed the problem down to this small example:

 

CREATE OR REPLACE PROCEDURE proc
(
   a_string INOUT VARCHAR
)
AS $$
<< proc >>
DECLARE
   val BIGINT;
BEGIN

   COMMIT;
   SELECT 0 INTO val;

END proc;
$$
LANGUAGE PLPGSQL;

CREATE OR REPLACE PROCEDURE proc_caller()
AS $$
<< proc_caller >>
DECLARE
   some_string VARCHAR := 'some_string';
BEGIN

   CALL proc(some_string);

END proc_caller;
$$
LANGUAGE PLPGSQL;

CALL proc_caller();

 

Upon running the final line, psql terminates with the following error:

 

SSL SYSCALL error: EOF detected

connection to server was lost

 

A few other observations I’ve made:

  1. Changing the a_string parameter from an INOUT type to IN type prevents the psql crash
  2. Removing the COMMIT prevents the psql crash
  3. Swapping the order of the SELECT and COMMIT prevents the psql crash

 

Thanks,

Chuck

pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #17147: Why concat_ws and concat is not immutable?
Next
From: Rainer Tammer
Date:
Subject: Re: Postgres 9.2.13 on AIX 7.1