BUG #16139: Assertion fails on INSERT into a postgres_fdw' table with two AFTER INSERT triggers

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: exclusion(at)gmail(dot)com
Subject: BUG #16139: Assertion fails on INSERT into a postgres_fdw' table with two AFTER INSERT triggers
Date: 2019-11-27 07:20:45
Message-ID: 16139-94f9ccf0db6119ec@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 16139
Logged by: Alexander Lakhin
Email address: exclusion(at)gmail(dot)com
PostgreSQL version: 12.1
Operating system: Ubuntu 18.04
Description:

The following script:
CREATE EXTENSION postgres_fdw;
CREATE SERVER loopback FOREIGN DATA WRAPPER postgres_fdw OPTIONS (dbname
'postgres');
CREATE USER MAPPING FOR CURRENT_USER SERVER loopback;
CREATE TABLE loc2 (f1 int);
CREATE FOREIGN TABLE rem2 (f1 int) SERVER loopback OPTIONS(table_name
'loc2');
CREATE OR REPLACE FUNCTION trigger_data() RETURNS trigger
LANGUAGE plpgsql AS 'begin return NEW; end;';

CREATE TRIGGER trigger1 AFTER INSERT ON rem2 FOR EACH ROW EXECUTE PROCEDURE
trigger_data();
CREATE TRIGGER trigger2 AFTER INSERT ON rem2 FOR EACH ROW EXECUTE PROCEDURE
trigger_data();
INSERT INTO rem2 VALUES(1);

raises the assertion:
Core was generated by `postgres: law regression [local] INSERT
'.
Program terminated with signal SIGABRT, Aborted.
#0 __GI_raise (sig=sig(at)entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0 __GI_raise (sig=sig(at)entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007fd866e97801 in __GI_abort () at abort.c:79
#2 0x000055c2cfc2f022 in ExceptionalCondition (
conditionName=conditionName(at)entry=0x55c2cfdaa228 "!(!(((slot)->tts_flags
& (1 << 1)) != 0))",
errorType=errorType(at)entry=0x55c2cfc86108 "FailedAssertion",
fileName=fileName(at)entry=0x55c2cfdc7e3b "execTuples.c",
lineNumber=lineNumber(at)entry=1620) at assert.c:54
#3 0x000055c2cf99380f in ExecFetchSlotHeapTuple
(slot=slot(at)entry=0x55c2d03b2bc8, materialize=materialize(at)entry=true,
shouldFree=shouldFree(at)entry=0x7ffd86cf260e) at execTuples.c:1620
#4 0x000055c2cf9609b7 in AfterTriggerExecute
(estate=estate(at)entry=0x55c2d039dd88, event=event(at)entry=0x55c2d03c0b7c,
relInfo=relInfo(at)entry=0x55c2d039e028,
trigdesc=trigdesc(at)entry=0x55c2d039e140, finfo=finfo(at)entry=0x55c2d039e300,
instr=instr(at)entry=0x0, per_tuple_context=0x55c2d03c2a50,
trig_tuple_slot1=0x55c2d03b2bc8,
trig_tuple_slot2=0x55c2d03b2c60) at trigger.c:4259
#5 0x000055c2cf960fa5 in afterTriggerInvokeEvents
(events=events(at)entry=0x55c2d034ebf8, firing_id=1,
estate=estate(at)entry=0x55c2d039dd88, delete_ok=delete_ok(at)entry=false) at
trigger.c:4540
#6 0x000055c2cf966876 in AfterTriggerEndQuery
(estate=estate(at)entry=0x55c2d039dd88) at trigger.c:4851
#7 0x000055c2cf986c53 in standard_ExecutorFinish (queryDesc=0x55c2d02edbc8)
at execMain.c:439
#8 0x000055c2cf986c74 in ExecutorFinish
(queryDesc=queryDesc(at)entry=0x55c2d02edbc8) at execMain.c:407
#9 0x000055c2cfb08771 in ProcessQuery (plan=plan(at)entry=0x55c2d03ac3d0,
sourceText=0x55c2d02ca3d8 "INSERT INTO rem2 VALUES(1);", params=0x0,
queryEnv=0x0, dest=dest(at)entry=0x55c2d03abe70,
completionTag=completionTag(at)entry=0x7ffd86cf29e0 "INSERT 0 1") at
pquery.c:203
#10 0x000055c2cfb088d2 in PortalRunMulti
(portal=portal(at)entry=0x55c2d0331498, isTopLevel=isTopLevel(at)entry=true,
setHoldSnapshot=setHoldSnapshot(at)entry=false,
dest=dest(at)entry=0x55c2d03abe70, altdest=altdest(at)entry=0x55c2d03abe70,
completionTag=completionTag(at)entry=0x7ffd86cf29e0 "INSERT 0 1") at
pquery.c:1283
#11 0x000055c2cfb0977d in PortalRun (portal=portal(at)entry=0x55c2d0331498,
count=count(at)entry=9223372036854775807,
isTopLevel=isTopLevel(at)entry=true, run_once=run_once(at)entry=true,
dest=dest(at)entry=0x55c2d03abe70,
altdest=altdest(at)entry=0x55c2d03abe70, completionTag=0x7ffd86cf29e0
"INSERT 0 1") at pquery.c:796
#12 0x000055c2cfb05a2d in exec_simple_query (
query_string=query_string(at)entry=0x55c2d02ca3d8 "INSERT INTO rem2
VALUES(1);") at postgres.c:1215
#13 0x000055c2cfb079fd in PostgresMain (argc=<optimized out>,
argv=argv(at)entry=0x55c2d02f5598, dbname=<optimized out>,
username=<optimized out>) at postgres.c:4236
#14 0x000055c2cfa79e2d in BackendRun (port=port(at)entry=0x55c2d02eb9d0) at
postmaster.c:4437
#15 0x000055c2cfa7d0f3 in BackendStartup (port=port(at)entry=0x55c2d02eb9d0) at
postmaster.c:4128
#16 0x000055c2cfa7d40a in ServerLoop () at postmaster.c:1704
#17 0x000055c2cfa7e7fb in PostmasterMain (argc=3, argv=<optimized out>) at
postmaster.c:1377
#18 0x000055c2cf9d9d87 in main (argc=3, argv=0x55c2d02c4a30) at main.c:228

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Etsuro Fujita 2019-11-27 08:20:19 Re: BUG #16139: Assertion fails on INSERT into a postgres_fdw' table with two AFTER INSERT triggers
Previous Message Tomas Vondra 2019-11-27 00:33:11 Re: Failed assertion clauses != NIL