| From: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | file_fdw: Fix ANALYZE crashes with DEFAULT markers |
| Date: | 2026-11-04 10:13:45 |
| Message-ID: | CAHGQGwGwihFV9FmfSbbrMsEr4fti7aHZFkpyMv5-byjfc2EmOw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
Running ANALYZE on a file_fdw table with a DEFAULT marker in the input
caused an assertion failure. Here is how to reproduce the issue:
---------------------------------------------------------------
printf 'DEFAULT\n' > /tmp/file_fdw_default.csv
Then run:
CREATE EXTENSION file_fdw;
CREATE SERVER fs FOREIGN DATA WRAPPER file_fdw;
CREATE FOREIGN TABLE ft (a integer DEFAULT 42)
SERVER fs
OPTIONS (filename '/tmp/file_fdw_default.csv',
format 'csv', "default" 'DEFAULT');
ANALYZE ft;
---------------------------------------------------------------
This causes the following assertion failure:
TRAP: failed Assert("econtext != NULL"), File: "copyfromparse.c",
Line: 1062, PID: 94428
Builds without assertions can also crash.
The issue occurs because the sampling code in file_fdw passes
a NULL ExprContext to NextCopyFrom(), which needs one to evaluate
column defaults.
Attached patch fixes this by providing an expression context for sampling.
This should be backpatched to v16, where DEFAULT marker support was
introduced.
Regards,
--
Fujii Masao
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-file_fdw-Fix-ANALYZE-crashes-with-DEFAULT-markers.patch | application/octet-stream | 4.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Zhijie Hou | 2026-11-04 10:28:52 | Re: Proposal: Conflict log history table for Logical Replication |
| Previous Message | Ajin Cherian | 2026-11-04 10:05:55 | Re: BUG? Unpublished generated columns are reported "missing" by the subscription |