public inbox for pgsql-bugs@postgresql.org  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: n.kalinin@postgrespro.ru
Subject: BUG #19476: Segmentation fault in contrib/spi
Date: Tue, 12 May 2026 14:23:39 +0000
Message-ID: <19476-bd04ea6241345303@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      19476
Logged by:          Nikita Kalinin
Email address:      n.kalinin@postgrespro.ru
PostgreSQL version: 18.3
Operating system:   Debian 13
Description:        

If this script is executed on the REL_18_STABLE branch, PostgreSQL crashes
with a segmentation fault:

CREATE EXTENSION refint;
CREATE TABLE c (id int4);
CREATE UNIQUE INDEX ci ON c(id);
CREATE TABLE b (refb int4);
CREATE INDEX bi ON b(refb);

CREATE TRIGGER at AFTER DELETE OR UPDATE ON c FOR EACH ROW
EXECUTE FUNCTION check_foreign_key (1, 'cascade', 'id', 'b', 'refb');

CREATE TRIGGER bt AFTER INSERT OR UPDATE ON b FOR EACH ROW
EXECUTE FUNCTION check_primary_key ('refb', 'c', 'id');

INSERT INTO c VALUES (10);
INSERT INTO b VALUES (10);
UPDATE c SET id = NULL WHERE id = 10;

Backtrace:
#0  __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:76
#1  0x0000563a92ca096e in quote_literal_cstr (rawstr=0x0) at quote.c:109
#2  0x00007fa4a7cce5f8 in check_foreign_key (fcinfo=<optimized out>) at
refint.c:489
#3  0x0000563a929c1d52 in ExecCallTriggerFunc
(trigdata=trigdata@entry=0x7fff8cae1100,
    tgindx=tgindx@entry=0, finfo=finfo@entry=0x563aa5ae4438,
instr=instr@entry=0x0,
    per_tuple_context=per_tuple_context@entry=0x563aa5adb9c0) at
trigger.c:2369
#4  0x0000563a929c4110 in AfterTriggerExecute (estate=<optimized out>,
event=0x563aa5aedbb0,
    relInfo=0x563aa5ae4068, src_relInfo=<optimized out>,
dst_relInfo=<optimized out>,
    trigdesc=0x563aa5ae4278, finfo=0x563aa5ae4438, instr=0x0,
    per_tuple_context=<optimized out>, trig_tuple_slot1=0x0,
trig_tuple_slot2=0x0)
    at trigger.c:4559
#5  afterTriggerInvokeEvents (events=events@entry=0x563aa5a75050,
firing_id=1,
    estate=estate@entry=0x563aa5ae3b20, delete_ok=delete_ok@entry=false) at
trigger.c:4800
#6  0x0000563a929c8e88 in AfterTriggerEndQuery
(estate=estate@entry=0x563aa5ae3b20)
    at trigger.c:5182
#7  0x0000563a929ed504 in standard_ExecutorFinish (queryDesc=0x563aa5996e20)
at execMain.c:443
#8  0x0000563a92bd96f8 in ProcessQuery (plan=0x563aa5af4168,
    sourceText=0x563aa59df7e0 "UPDATE c SET id = NULL WHERE id = 10;",
params=0x0,
    queryEnv=0x0, dest=0x563aa5aeae28, qc=0x7fff8cae1460) at pquery.c:194
#9  0x0000563a92bda41e in PortalRunMulti
(portal=portal@entry=0x563aa5a60510,
    isTopLevel=isTopLevel@entry=true,
setHoldSnapshot=setHoldSnapshot@entry=false,
--Type <RET> for more, q to quit, c to continue without paging--c
    dest=dest@entry=0x563aa5aeae28, altdest=altdest@entry=0x563aa5aeae28,
    qc=qc@entry=0x7fff8cae1460) at pquery.c:1272
#10 0x0000563a92bda7f7 in PortalRun (portal=portal@entry=0x563aa5a60510,
    count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=true,
    dest=dest@entry=0x563aa5aeae28, altdest=altdest@entry=0x563aa5aeae28,
    qc=qc@entry=0x7fff8cae1460) at pquery.c:788
#11 0x0000563a92bd63fa in exec_simple_query (
    query_string=0x563aa59df7e0 "UPDATE c SET id = NULL WHERE id = 10;") at
postgres.c:1274
#12 0x0000563a92bd7fc5 in PostgresMain (dbname=<optimized out>,
username=<optimized out>)
    at postgres.c:4770
#13 0x0000563a92bd23bd in BackendMain (startup_data=<optimized out>,
    startup_data_len=<optimized out>) at backend_startup.c:124
#14 0x0000563a92b24932 in postmaster_child_launch (child_type=<optimized
out>, child_slot=1,
    startup_data=startup_data@entry=0x7fff8cae1900,
    startup_data_len=startup_data_len@entry=24,
client_sock=client_sock@entry=0x7fff8cae1920)
    at launch_backend.c:290
#15 0x0000563a92b283d2 in BackendStartup (client_sock=0x7fff8cae1920) at
postmaster.c:3569
#16 ServerLoop () at postmaster.c:1703
#17 0x0000563a92b29ea6 in PostmasterMain (argc=argc@entry=3,
argv=argv@entry=0x563aa5985bf0)
    at postmaster.c:1401
#18 0x0000563a92800a5a in main (argc=3, argv=0x563aa5985bf0) at main.c:227







reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, n.kalinin@postgrespro.ru
  Subject: Re: BUG #19476: Segmentation fault in contrib/spi
  In-Reply-To: <19476-bd04ea6241345303@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox