Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wPSyT-000kff-0K for pgsql-bugs@arkaria.postgresql.org; Tue, 19 May 2026 22:31:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wPSyR-005LEz-07 for pgsql-bugs@arkaria.postgresql.org; Tue, 19 May 2026 22:31:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wOrd9-001NyX-2d for pgsql-bugs@lists.postgresql.org; Mon, 18 May 2026 06:39:13 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wOrd6-000000008u5-37J5 for pgsql-bugs@lists.postgresql.org; Mon, 18 May 2026 06:39:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:Cc:From:To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Content-ID: Content-Description:In-Reply-To:References; bh=HQnoCkB276BIMfzyoZYtxtIyD5wFy20nm5XQOYZ+CHA=; b=yuYNPN+9LnSEEBpKgV9YhWOKu5 TATZqpUB/aBiW2wkwi55bX1IE8fG44ppNOsAhrv2kIy82G36yxmLIYk1qFnigCDT58wi8y307rNUX Cx6xZRYegXQuHOV0XwDUu8w3D0Wi6vuFb76RXMoeZLIeb3Iun7ZPu9BxdLPV6DQ5Mk6yNGvyJ6mdG Bb1daqeIZ0XF1kFIJC23qPOCsaeun+mFngHrwKOqIiCQ07bX+Kk49Io0DVEzaDi/FrhiTLxzWsZic xF//C6cHr2BAAu3gH51T4Y1vqCX36XPDBbc67FQ0Cvg4C7JG+QNqwPhyJXHrzwiKggvWC8x+4sGvC fX8zGA+w==; Received: from wrigleys.postgresql.org ([2a02:16a8:dc51::60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wOrd1-000NhH-0k for pgsql-bugs@lists.postgresql.org; Mon, 18 May 2026 06:39:07 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wOrd1-000nuI-1E for pgsql-bugs@lists.postgresql.org; Mon, 18 May 2026 06:39:03 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19484: Segmentation fault triggered by FDW To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: 798604270@qq.com Reply-To: 798604270@qq.com, pgsql-bugs@lists.postgresql.org Date: Mon, 18 May 2026 06:38:34 +0000 Message-ID: <19484-a3cb82c8cde3c8fa@postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk The following bug has been logged on the website: Bug reference: 19484 Logged by: Chi Zhang Email address: 798604270@qq.com PostgreSQL version: 18.4 Operating system: Ubuntu 24.04 Description: =20 Hi, I found the following test case triggers a segmentation fault: ``` \set ON_ERROR_STOP on CREATE EXTENSION postgres_fdw; CREATE SERVER loopback FOREIGN DATA WRAPPER postgres_fdw OPTIONS ( host '/path/to/pg_socket', port '5432', dbname :'dbname' ); CREATE USER MAPPING FOR postgres SERVER loopback OPTIONS (user 'postgres'); CREATE SCHEMA r; CREATE TABLE r.remote_p2 (a int NOT NULL, b int); CREATE TABLE pt (a int NOT NULL, b int) PARTITION BY LIST (a); CREATE TABLE pt_p1 PARTITION OF pt FOR VALUES IN (1); CREATE FOREIGN TABLE pt_p2 PARTITION OF pt FOR VALUES IN (2) SERVER loopback OPTIONS (schema_name 'r', table_name 'remote_p2'); INSERT INTO pt_p1 VALUES (1, 10); INSERT INTO r.remote_p2 VALUES (2, 20); SET plan_cache_mode =3D force_generic_plan; PREPARE upd(int) AS UPDATE pt SET b =3D b + 1 WHERE a =3D $1 RETURNING tableoid::regclass, a, b; EXPLAIN (costs off) EXECUTE upd(2); EXECUTE upd(2); SELECT * FROM r.remote_p2 ORDER BY a; ``` This is the log: ``` 2026-05-18 13:40:41.888 CST [21729] LOG: database system is ready to accept connections 2026-05-18 13:41:03.317 CST [21932] LOG: unexpected EOF on client connection with an open transaction 2026-05-18 13:41:03.317 CST [21729] LOG: client backend (PID 21931) was terminated by signal 11: Segmentation fault 2026-05-18 13:41:03.317 CST [21729] DETAIL: Failed process was running: EXECUTE upd(2); 2026-05-18 13:41:03.317 CST [21729] LOG: terminating any other active server processes 2026-05-18 13:41:03.319 CST [21729] LOG: all server processes terminated; reinitializing 2026-05-18 13:41:03.345 CST [21936] LOG: database system was interrupted; last known up at 2026-05-18 13:40:41 CST 2026-05-18 13:41:03.509 CST [21936] LOG: database system was not properly shut down; automatic recovery in progress 2026-05-18 13:41:03.513 CST [21936] LOG: redo starts at 0/98371040 2026-05-18 13:41:03.531 CST [21936] LOG: invalid record length at 0/987B6E68: expected at least 24, got 0 2026-05-18 13:41:03.531 CST [21936] LOG: redo done at 0/987B6E40 system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.01 s 2026-05-18 13:41:03.537 CST [21937] LOG: checkpoint starting: end-of-recovery fast wait 2026-05-18 13:41:03.654 CST [21937] LOG: checkpoint complete: end-of-recovery fast wait: wrote 975 buffers (6.0%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=3D0.081 s, sync=3D0.030 s, total=3D0.121 s; sync files=3D32= 5, longest=3D0.005 s, average=3D0.001 s; distance=3D4375 kB, estimate=3D4375 k= B; lsn=3D0/987B6E68, redo lsn=3D0/987B6E68 2026-05-18 13:41:03.660 CST [21729] LOG: database system is ready to accept connections ``` I built the Postgres from source code 901ed9b352b41f034e17bc540725082a488fce31 of github commit.