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 1x4Jvs-0074Pp-0r for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Sep 2026 15:09:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x4Jvo-00Fsjd-2b for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Sep 2026 15:09:48 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x4Jvo-00FsjS-14 for pgsql-hackers@lists.postgresql.org; Wed, 09 Sep 2026 15:09:48 +0000 Received: from mail.postgrespro.ru ([93.174.132.70]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x4Jvl-00000004nCJ-0n0L for pgsql-hackers@lists.postgresql.org; Wed, 09 Sep 2026 15:09:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1788966582; bh=w/UVmZ3RLOe564ek+Yf8Ek3PpmiugCqn4+l+y9E3/dI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:Message-ID:From; b=UBQ2DlSxwZzT7xRhFsr87E1CDpXJXXCJ8Ax9eVU/26z5fr09w2Ysw8VHzFwJzrDO3 Spg3D8b+EWa1MfZCb2zQytoUrWMFd1wj6KMrYVCs4lELTkFcWuG5yfu1dI+tMrAZER y8RAH3cjx9RTGzbSp3WH8V7GPLihyPtgQbHFKy8VjPqWuNXMkIC3wEvj30U2LaSSd6 7VunJX8vG2hczOjUqz5+GGOlLA3TxaiXMjU89UUBkODSCuk/PwP2PGMAOq/4pZpxUD 3phkfPz+TWiEYt3dI1Q1whCaRtPGUFsg+BsFQXrJEbgINUw7oaRTu8KqlwJscLvKqr gjb4rzP935bjg== Received: from mail.l.postgrespro.ru (webmail-master-mstn.l.postgrespro.ru [192.168.2.26]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: a.pyhalov@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id 5109262784; Wed, 09 Sep 2026 18:09:42 +0300 (MSK) MIME-Version: 1.0 Date: Wed, 09 Sep 2026 18:09:42 +0300 From: Alexander Pyhalov To: Fujii Masao Cc: PostgreSQL Hackers Subject: Re: postgres_fdw: Fix crash when estimating joins with functions In-Reply-To: References: Message-ID: X-Sender: a.pyhalov@postgrespro.ru Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-KSMG-AntiPhishing: NotDetected X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 3.0.0.9059, bases: 2026/09/09 09:52:00 #28566849 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: not scanned, disabled by settings X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Fujii Masao писал(а) 2026-09-09 17:02: > Hi, > > On master, I found that the following causes a segmentation fault: > > CREATE EXTENSION postgres_fdw; > CREATE SERVER loopback FOREIGN DATA WRAPPER postgres_fdw; > CREATE USER MAPPING FOR PUBLIC SERVER loopback; > CREATE TABLE t (i int); > CREATE FOREIGN TABLE ft (i int) SERVER loopback > OPTIONS (table_name 't', use_remote_estimate 'true'); > EXPLAIN SELECT * FROM generate_series(1, 3) g JOIN ft ON ft.i = g; > > This crash seems to occur because init_func_stub_fpinfo() forgets to > copy > the user mapping to the function-side stub, leaving it NULL. The NULL > mapping is then passed to GetConnection() when requesting a remote > estimate, causing the segmentation fault. > > This seems to have been introduced by commit 0ee83dd4a99. > > The attached patch fixes this by also copying the user mapping from the > foreign side. > > Regards, Hi. Thanks. Looks good to me. -- Best regards, Alexander Pyhalov, Postgres Professional