agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Fix spurious errors in COPY FROM (FORMAT {text,csv}).
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix spurious errors in COPY FROM (FORMAT {text,csv}).
@ 2026-09-01 19:21  Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Nathan Bossart @ 2026-09-01 19:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix spurious errors in COPY FROM (FORMAT {text,csv}).

The SIMD path for these commands reads ahead into the input buffer
via CopyLoadInputBuf(), which reports encoding and conversion
errors.  The problem is that the errant data might lie beyond the
end-of-copy marker, which we aren't copying and thus needn't error
for.  To fix, add a "speculative" parameter to CopyLoadInputBuf()
that defers these errors, and use it in the SIMD path.  The errors
are instead reported only if we actually reach the errant data.
Testing indicates this does not meaningfully impact performance.

Oversight in commit e0a3a3fd53.

Reviewed-by: Greg Burd <greg@burd.me>
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/apWOr1kgVSqweBnU%40nathan
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/348f4ab53a080af611c92ad638781500ac53fe09

Modified Files
--------------
src/backend/commands/copyfromparse.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix spurious errors in COPY FROM (FORMAT {text,csv}).
@ 2026-09-01 19:21  Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Nathan Bossart @ 2026-09-01 19:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix spurious errors in COPY FROM (FORMAT {text,csv}).

The SIMD path for these commands reads ahead into the input buffer
via CopyLoadInputBuf(), which reports encoding and conversion
errors.  The problem is that the errant data might lie beyond the
end-of-copy marker, which we aren't copying and thus needn't error
for.  To fix, add a "speculative" parameter to CopyLoadInputBuf()
that defers these errors, and use it in the SIMD path.  The errors
are instead reported only if we actually reach the errant data.
Testing indicates this does not meaningfully impact performance.

Oversight in commit e0a3a3fd53.

Reviewed-by: Greg Burd <greg@burd.me>
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/apWOr1kgVSqweBnU%40nathan
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/f26ab219e28ceb88b29f9165800879548dcc6646

Modified Files
--------------
src/backend/commands/copyfromparse.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-09-01 19:21 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-01 19:21 pgsql: Fix spurious errors in COPY FROM (FORMAT {text,csv}). Nathan Bossart <nathan@postgresql.org>
2026-09-01 19:21 pgsql: Fix spurious errors in COPY FROM (FORMAT {text,csv}). Nathan Bossart <nathan@postgresql.org>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox