| From: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | postgres_fdw: Fix crash when estimating joins with functions |
| Date: | 2026-09-09 14:02:26 |
| Message-ID: | CAHGQGwGE9xPzCke0C0r4omTkh-hU08aBd2j9oSA0FYmJLCf9jA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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,
--
Fujii Masao
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-postgres_fdw-Fix-crash-when-estimating-joins-with.patch | application/octet-stream | 1.9 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ayoub Kazar | 2026-09-09 14:06:10 | Re: Add pg_stat_vfdcache view for VFD cache statistics |
| Previous Message | Xuneng Zhou | 2026-09-09 14:00:55 | Re: Reject WAIT FOR earlier in transaction-snapshot mode |