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:
- Changing the a_string parameter from an INOUT type to IN type prevents the psql crash
- Removing the COMMIT prevents the psql crash
- Swapping the order of the SELECT and COMMIT prevents the psql crash
Thanks,
Chuck