postgres.git / summary / log / commit / refs

commit    0b355d4277e76d6ae691855070e20da703789cea
Author:   Fujii Masao <fujii@postgresql.org>
Date:     Wed Nov 11 01:05:56 2026 +0000
First released in: 19.0

    doc: Explain that ANALYZE ignores reject_limit in file_fdw
    
    The documentation did not explain that ANALYZE on file_fdw foreign tables
    ignores reject_limit, which could lead users to expect it to fail when
    the number of skipped rows exceeded the limit.
    
    Ignoring the limit allows statistics to be collected from valid rows
    even when the limit is exceeded. These statistics can still be useful for
    queries using LIMIT, for example, which may finish before encountering
    enough conversion errors to exceed reject_limit.
    
    Document this exception and its rationale.
    
    Backpatch to v18, where reject_limit support was added to file_fdw.
    
    Author: Ayoub Kazar <ayoub.kazar@data-bene.io>
    Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
    Discussion: https://postgr.es/m/6cc479df-7571-4393-a572-f46dba1bfcbf@data-bene.io
    Backpatch-through: 18


contrib/file_fdw/file_fdw.c | 6 +++++- doc/src/sgml/file-fdw.sgml | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/contrib/file_fdw/file_fdw.c b/contrib/file_fdw/file_fdw.c index 0f622470025..0fc5b85f6fd 100644 --- a/contrib/file_fdw/file_fdw.c +++ b/contrib/file_fdw/file_fdw.c @@ -1266,7 +1266,11 @@ file_acquire_sample_rows(Relation onerel, int elevel, */ cstate->escontext->error_occurred = false; - /* Repeat NextCopyFrom() until no soft error occurs */ + /* + * Unlike fileIterateForeignScan(), we intentionally ignore + * reject_limit so that ANALYZE can collect statistics from + * valid rows even if the limit is exceeded. + */ continue; } diff --git a/doc/src/sgml/file-fdw.sgml b/doc/src/sgml/file-fdw.sgml index 3638689436f..ad29f4f9e01 100644 --- a/doc/src/sgml/file-fdw.sgml +++ b/doc/src/sgml/file-fdw.sgml @@ -156,7 +156,10 @@ <para> Specifies the maximum number of errors tolerated while converting a column's input value to its data type, the same as <command>COPY</command>'s - <literal>REJECT_LIMIT</literal> option. + <literal>REJECT_LIMIT</literal> option. + This limit is not enforced when <command>ANALYZE</command> samples rows + from the foreign table, so that statistics can still be collected + from valid rows. </para> </listitem> </varlistentry> [parent: a0276831ad77]