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 <[email protected]>
Reviewed-by: Nazir Bilal Yavuz <[email protected]>
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(-)

Reply via email to