#311 plpgsql: failed to send COMMIT command to node

1.3 Dev Q
open
nobody
5
2013-12-03
2012-05-11
Michael Paquier
No

create temp table master(f1 int primary key);
create temp table slave(f1 int references master deferrable);

insert into master values(1);
insert into slave values(1);
insert into slave values(2); -- fails?

create function trap_foreign_key(int) returns int as $$
begin
begin
insert into slave values($1);
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);
select trap_foreign_key(2); -- Error here
-- NOTICE: caught foreign_key_violation
-- ERROR: failed to send COMMIT command to node

This happens after catching an exception on a plpsql function.
Strangely it is easy to reproduce with psql but does not appear all the time with regressions.

Discussion

  • Moving that to 1.1 bucket

     
    • milestone: 2663488 --> 2663467
     
  • Koichi Suzuki
    Koichi Suzuki
    2012-06-03

    Depending on the environment. Only reproducible on Michael's machine, but not on the buildfarm.

     
  • Koichi Suzuki
    Koichi Suzuki
    2012-06-03

    • labels: --> Database Server
     
  • Koichi Suzuki
    Koichi Suzuki
    2012-09-12

    Q3

     
  • Koichi Suzuki
    Koichi Suzuki
    2013-03-12

    • assigned_to: michaelpq --> nobody
     
  • Koichi Suzuki
    Koichi Suzuki
    2013-06-11

    • milestone: 2663467 --> 1,2 Dev Q
     
  • Koichi Suzuki
    Koichi Suzuki
    2013-06-11

    This is a random failure nature. Regarding the resource and severity, we change the group to 1.2 dev.

     
  • Koichi Suzuki
    Koichi Suzuki
    2013-12-03

    • Group: 1.2 Dev Q --> 1.3 Dev Q
     
  • Amit Khandekar
    Amit Khandekar
    2013-12-03

    I suspect this issue can possibly be due to sourceforge bug id #57. Postgres-XC does not currently handle sub-transactions. pl/pgsql exception block does not work correctly since it is implemented using subtransactions.