diff -U3 /tmp/cirrus-ci-build/src/pl/plpgsql/src/expected/plpgsql_trap.out /tmp/cirrus-ci-build/build/testrun/plpgsql-running/regress/results/plpgsql_trap.out --- /tmp/cirrus-ci-build/src/pl/plpgsql/src/expected/plpgsql_trap.out 2024-04-02 00:56:35.778134000 +0000 +++ /tmp/cirrus-ci-build/build/testrun/plpgsql-running/regress/results/plpgsql_trap.out 2024-04-02 00:59:54.116397000 +0000 @@ -155,101 +155,10 @@ begin; set statement_timeout to 1000; select trap_timeout(); -NOTICE: nyeah nyeah, can't stop me -ERROR: end of function -CONTEXT: PL/pgSQL function trap_timeout() line 15 at RAISE -rollback; --- Test for pass-by-ref values being stored in proper context -create function test_variable_storage() returns text as $$ -declare x text; -begin - x := '1234'; - begin - x := x || '5678'; - -- force error inside subtransaction SPI context - perform trap_zero_divide(-100); - exception - when others then - x := x || '9012'; - end; - return x; -end$$ language plpgsql; -select test_variable_storage(); -NOTICE: should see this -NOTICE: should see this only if -100 <> 0 -NOTICE: should see this only if -100 fits in smallint - test_variable_storage ------------------------ - 123456789012 -(1 row) - --- --- test foreign key error trapping --- -create temp table root(f1 int primary key); -create temp table leaf(f1 int references root deferrable); -insert into root values(1); -insert into leaf values(1); -insert into leaf values(2); -- fails -ERROR: insert or update on table "leaf" violates foreign key constraint "leaf_f1_fkey" -DETAIL: Key (f1)=(2) is not present in table "root". -create function trap_foreign_key(int) returns int as $$ -begin - begin -- start a subtransaction - insert into leaf values($1); - exception - when foreign_key_violation then - raise notice 'caught foreign_key_violation'; - return 0; - end; - return 1; -end$$ language plpgsql; -create function trap_foreign_key_2() returns int as $$ -begin - begin -- start a subtransaction - set constraints all immediate; - exception - when foreign_key_violation then - raise notice 'caught foreign_key_violation'; - return 0; - end; - return 1; -end$$ language plpgsql; -select trap_foreign_key(1); - trap_foreign_key ------------------- - 1 -(1 row) - -select trap_foreign_key(2); -- detects FK violation -NOTICE: caught foreign_key_violation - trap_foreign_key ------------------- - 0 -(1 row) - -begin; - set constraints all deferred; - select trap_foreign_key(2); -- should not detect FK violation - trap_foreign_key ------------------- - 1 -(1 row) - - savepoint x; - set constraints all immediate; -- fails -ERROR: insert or update on table "leaf" violates foreign key constraint "leaf_f1_fkey" -DETAIL: Key (f1)=(2) is not present in table "root". - rollback to x; - select trap_foreign_key_2(); -- detects FK violation -NOTICE: caught foreign_key_violation - trap_foreign_key_2 --------------------- - 0 -(1 row) - -commit; -- still fails -ERROR: insert or update on table "leaf" violates foreign key constraint "leaf_f1_fkey" -DETAIL: Key (f1)=(2) is not present in table "root". -drop function trap_foreign_key(int); -drop function trap_foreign_key_2(); +WARNING: terminating connection because of crash of another server process +DETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory. +HINT: In a moment you should be able to reconnect to the database and repeat your command. +server closed the connection unexpectedly + This probably means the server terminated abnormally + before or while processing the request. +connection to server was lost diff -U3 /tmp/cirrus-ci-build/src/pl/plpgsql/src/expected/plpgsql_trigger.out /tmp/cirrus-ci-build/build/testrun/plpgsql-running/regress/results/plpgsql_trigger.out --- /tmp/cirrus-ci-build/src/pl/plpgsql/src/expected/plpgsql_trigger.out 2024-04-02 00:56:35.778183000 +0000 +++ /tmp/cirrus-ci-build/build/testrun/plpgsql-running/regress/results/plpgsql_trigger.out 2024-04-02 00:59:54.126791000 +0000 @@ -1,36 +1,2 @@ --- Simple test to verify accessibility of the OLD and NEW trigger variables -create table testtr (a int, b text); -create function testtr_trigger() returns trigger language plpgsql as -$$begin - raise notice 'tg_op = %', tg_op; - raise notice 'old(%) = %', old.a, row(old.*); - raise notice 'new(%) = %', new.a, row(new.*); - if (tg_op = 'DELETE') then - return old; - else - return new; - end if; -end$$; -create trigger testtr_trigger before insert or delete or update on testtr - for each row execute function testtr_trigger(); -insert into testtr values (1, 'one'), (2, 'two'); -NOTICE: tg_op = INSERT -NOTICE: old() = (,) -NOTICE: new(1) = (1,one) -NOTICE: tg_op = INSERT -NOTICE: old() = (,) -NOTICE: new(2) = (2,two) -update testtr set a = a + 1; -NOTICE: tg_op = UPDATE -NOTICE: old(1) = (1,one) -NOTICE: new(2) = (2,one) -NOTICE: tg_op = UPDATE -NOTICE: old(2) = (2,two) -NOTICE: new(3) = (3,two) -delete from testtr; -NOTICE: tg_op = DELETE -NOTICE: old(2) = (2,one) -NOTICE: new() = (,) -NOTICE: tg_op = DELETE -NOTICE: old(3) = (3,two) -NOTICE: new() = (,) +psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory + Is the server running locally and accepting connections on that socket? diff -U3 /tmp/cirrus-ci-build/src/pl/plpgsql/src/expected/plpgsql_varprops.out /tmp/cirrus-ci-build/build/testrun/plpgsql-running/regress/results/plpgsql_varprops.out --- /tmp/cirrus-ci-build/src/pl/plpgsql/src/expected/plpgsql_varprops.out 2024-04-02 00:56:35.778277000 +0000 +++ /tmp/cirrus-ci-build/build/testrun/plpgsql-running/regress/results/plpgsql_varprops.out 2024-04-02 00:59:54.140741000 +0000 @@ -1,298 +1,2 @@ --- --- Tests for PL/pgSQL variable properties: CONSTANT, NOT NULL, initializers --- -create type var_record as (f1 int4, f2 int4); -create domain int_nn as int not null; -create domain var_record_nn as var_record not null; -create domain var_record_colnn as var_record check((value).f2 is not null); --- CONSTANT -do $$ -declare x constant int := 42; -begin - raise notice 'x = %', x; -end$$; -NOTICE: x = 42 -do $$ -declare x constant int; -begin - x := 42; -- fail -end$$; -ERROR: variable "x" is declared CONSTANT -LINE 4: x := 42; -- fail - ^ -do $$ -declare x constant int; y int; -begin - for x, y in select 1, 2 loop -- fail - end loop; -end$$; -ERROR: variable "x" is declared CONSTANT -LINE 4: for x, y in select 1, 2 loop -- fail - ^ -do $$ -declare x constant int[]; -begin - x[1] := 42; -- fail -end$$; -ERROR: variable "x" is declared CONSTANT -LINE 4: x[1] := 42; -- fail - ^ -do $$ -declare x constant int[]; y int; -begin - for x[1], y in select 1, 2 loop -- fail (currently, unsupported syntax) - end loop; -end$$; -ERROR: syntax error at or near "[" -LINE 4: for x[1], y in select 1, 2 loop -- fail (currently, unsup... - ^ -do $$ -declare x constant var_record; -begin - x.f1 := 42; -- fail -end$$; -ERROR: variable "x" is declared CONSTANT -LINE 4: x.f1 := 42; -- fail - ^ -do $$ -declare x constant var_record; y int; -begin - for x.f1, y in select 1, 2 loop -- fail - end loop; -end$$; -ERROR: variable "x" is declared CONSTANT -LINE 4: for x.f1, y in select 1, 2 loop -- fail - ^ --- initializer expressions -do $$ -declare x int := sin(0); -begin - raise notice 'x = %', x; -end$$; -NOTICE: x = 0 -do $$ -declare x int := 1/0; -- fail -begin - raise notice 'x = %', x; -end$$; -ERROR: division by zero -CONTEXT: SQL expression "1/0" -PL/pgSQL function inline_code_block line 2 during statement block local variable initialization -do $$ -declare x bigint[] := array[1,3,5]; -begin - raise notice 'x = %', x; -end$$; -NOTICE: x = {1,3,5} -do $$ -declare x record := row(1,2,3); -begin - raise notice 'x = %', x; -end$$; -NOTICE: x = (1,2,3) -do $$ -declare x var_record := row(1,2); -begin - raise notice 'x = %', x; -end$$; -NOTICE: x = (1,2) --- NOT NULL -do $$ -declare x int not null; -- fail -begin - raise notice 'x = %', x; -end$$; -ERROR: variable "x" must have a default value, since it's declared NOT NULL -LINE 2: declare x int not null; -- fail - ^ -do $$ -declare x int not null := 42; -begin - raise notice 'x = %', x; - x := null; -- fail -end$$; -NOTICE: x = 42 -ERROR: null value cannot be assigned to variable "x" declared NOT NULL -CONTEXT: PL/pgSQL function inline_code_block line 5 at assignment -do $$ -declare x int not null := null; -- fail -begin - raise notice 'x = %', x; -end$$; -ERROR: null value cannot be assigned to variable "x" declared NOT NULL -CONTEXT: PL/pgSQL function inline_code_block line 2 during statement block local variable initialization -do $$ -declare x record not null; -- fail -begin - raise notice 'x = %', x; -end$$; -ERROR: variable "x" must have a default value, since it's declared NOT NULL -LINE 2: declare x record not null; -- fail - ^ -do $$ -declare x record not null := row(42); -begin - raise notice 'x = %', x; - x := row(null); -- ok - raise notice 'x = %', x; - x := null; -- fail -end$$; -NOTICE: x = (42) -NOTICE: x = () -ERROR: null value cannot be assigned to variable "x" declared NOT NULL -CONTEXT: PL/pgSQL function inline_code_block line 7 at assignment -do $$ -declare x record not null := null; -- fail -begin - raise notice 'x = %', x; -end$$; -ERROR: null value cannot be assigned to variable "x" declared NOT NULL -CONTEXT: PL/pgSQL function inline_code_block line 2 during statement block local variable initialization -do $$ -declare x var_record not null; -- fail -begin - raise notice 'x = %', x; -end$$; -ERROR: variable "x" must have a default value, since it's declared NOT NULL -LINE 2: declare x var_record not null; -- fail - ^ -do $$ -declare x var_record not null := row(41,42); -begin - raise notice 'x = %', x; - x := row(null,null); -- ok - raise notice 'x = %', x; - x := null; -- fail -end$$; -NOTICE: x = (41,42) -NOTICE: x = (,) -ERROR: null value cannot be assigned to variable "x" declared NOT NULL -CONTEXT: PL/pgSQL function inline_code_block line 7 at assignment -do $$ -declare x var_record not null := null; -- fail -begin - raise notice 'x = %', x; -end$$; -ERROR: null value cannot be assigned to variable "x" declared NOT NULL -CONTEXT: PL/pgSQL function inline_code_block line 2 during statement block local variable initialization --- Check that variables are reinitialized on block re-entry. -do $$ -begin - for i in 1..3 loop - declare - x int; - y int := i; - r record; - c var_record; - begin - if i = 1 then - x := 42; - r := row(i, i+1); - c := row(i, i+1); - end if; - raise notice 'x = %', x; - raise notice 'y = %', y; - raise notice 'r = %', r; - raise notice 'c = %', c; - end; - end loop; -end$$; -NOTICE: x = 42 -NOTICE: y = 1 -NOTICE: r = (1,2) -NOTICE: c = (1,2) -NOTICE: x = -NOTICE: y = 2 -NOTICE: r = -NOTICE: c = -NOTICE: x = -NOTICE: y = 3 -NOTICE: r = -NOTICE: c = --- Check enforcement of domain constraints during initialization -do $$ -declare x int_nn; -- fail -begin - raise notice 'x = %', x; -end$$; -ERROR: domain int_nn does not allow null values -CONTEXT: PL/pgSQL function inline_code_block line 2 during statement block local variable initialization -do $$ -declare x int_nn := null; -- fail -begin - raise notice 'x = %', x; -end$$; -ERROR: domain int_nn does not allow null values -CONTEXT: PL/pgSQL function inline_code_block line 2 during statement block local variable initialization -do $$ -declare x int_nn := 42; -begin - raise notice 'x = %', x; - x := null; -- fail -end$$; -NOTICE: x = 42 -ERROR: domain int_nn does not allow null values -CONTEXT: PL/pgSQL function inline_code_block line 5 at assignment -do $$ -declare x var_record_nn; -- fail -begin - raise notice 'x = %', x; -end$$; -ERROR: domain var_record_nn does not allow null values -CONTEXT: PL/pgSQL function inline_code_block line 2 during statement block local variable initialization -do $$ -declare x var_record_nn := null; -- fail -begin - raise notice 'x = %', x; -end$$; -ERROR: domain var_record_nn does not allow null values -CONTEXT: PL/pgSQL function inline_code_block line 2 during statement block local variable initialization -do $$ -declare x var_record_nn := row(1,2); -begin - raise notice 'x = %', x; - x := row(null,null); -- ok - x := null; -- fail -end$$; -NOTICE: x = (1,2) -ERROR: domain var_record_nn does not allow null values -CONTEXT: PL/pgSQL function inline_code_block line 6 at assignment -do $$ -declare x var_record_colnn; -- fail -begin - raise notice 'x = %', x; -end$$; -ERROR: value for domain var_record_colnn violates check constraint "var_record_colnn_check" -CONTEXT: PL/pgSQL function inline_code_block line 2 during statement block local variable initialization -do $$ -declare x var_record_colnn := null; -- fail -begin - raise notice 'x = %', x; -end$$; -ERROR: value for domain var_record_colnn violates check constraint "var_record_colnn_check" -CONTEXT: PL/pgSQL function inline_code_block line 2 during statement block local variable initialization -do $$ -declare x var_record_colnn := row(1,null); -- fail -begin - raise notice 'x = %', x; -end$$; -ERROR: value for domain var_record_colnn violates check constraint "var_record_colnn_check" -CONTEXT: PL/pgSQL function inline_code_block line 2 during statement block local variable initialization -do $$ -declare x var_record_colnn := row(1,2); -begin - raise notice 'x = %', x; - x := null; -- fail -end$$; -NOTICE: x = (1,2) -ERROR: value for domain var_record_colnn violates check constraint "var_record_colnn_check" -CONTEXT: PL/pgSQL function inline_code_block line 5 at assignment -do $$ -declare x var_record_colnn := row(1,2); -begin - raise notice 'x = %', x; - x := row(null,null); -- fail -end$$; -NOTICE: x = (1,2) -ERROR: value for domain var_record_colnn violates check constraint "var_record_colnn_check" -CONTEXT: PL/pgSQL function inline_code_block line 5 at assignment +psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory + Is the server running locally and accepting connections on that socket?