Hi, On Mon, 31 Aug 2026 at 17:24, Nathan Bossart <[email protected]> wrote: > > Claude found this bug: > > CREATE TABLE t (a TEXT); > COPY t FROM PROGRAM $$printf > 'abcdefghijklmnopqrst\n\\.\nxxxxxxxxxxxx\200'$$; > > fails with > > ERROR: invalid byte sequence for encoding "UTF8": 0x80 > CONTEXT: COPY t, line 2 > > even though COPY should ignore everything after the \.
Nice catch! I can reproduce the problem and confirm that the patch fixes it. > The best fix I could find involves teaching CopyLoadInputBuf() to avoid > erroring in the read-ahead path. AFAICT that doesn't meaningfully change > the performance characteristics. Patch attached. That seems like the easiest fix without complicating the code. I will review this code in more detail tomorrow, but I think adding the reproducer above as a test case makes sense to me. -- Regards, Nazir Bilal Yavuz Microsoft
