From: Fujii Masao <fujii@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: file_fdw: Fix ANALYZE crashes with DEFAULT markers
Date: Fri, 06 Nov 2026 14:34:37 +0000
Message-ID: <E1xPL1a-00000000TPZ-0cem@gemulon.postgresql.org> (raw)
file_fdw: Fix ANALYZE crashes with DEFAULT markers
ANALYZE on a file_fdw foreign table failed an assertion when the input
contained a DEFAULT marker, and could crash in builds without assertions.
This happened because the sampling code passed a NULL ExprContext to
NextCopyFrom(), which requires one to evaluate column defaults. Fix
this by providing an expression context for sampling, allowing defaults
to be evaluated without assertion failures or crashes.
Backpatch to v16, which introduced DEFAULT marker support.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Jim Jones <jim.jones@uni-muenster.de>
Reviewed-by: Ayoub Kazar <ayoub.kazar@data-bene.io>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwGwihFV9FmfSbbrMsEr4fti7aHZFkpyMv5-byjfc2EmOw@mail.gmail.com
Backpatch-through: 16
Branch
------
REL_18_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/813a74bc5a76f13c15da902f5523d0fa755e2c5f
Modified Files
--------------
contrib/file_fdw/expected/file_fdw.out | 10 ++++++++++
contrib/file_fdw/file_fdw.c | 24 +++++++++++++-----------
contrib/file_fdw/sql/file_fdw.sql | 5 +++++
3 files changed, 28 insertions(+), 11 deletions(-)
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: fujii@postgresql.org
Subject: Re: pgsql: file_fdw: Fix ANALYZE crashes with DEFAULT markers
In-Reply-To: <E1xPL1a-00000000TPZ-0cem@gemulon.postgresql.org>
References: <E1xPL1a-00000000TPZ-0cem@gemulon.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 DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox