Re: New "single" COPY format - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: New "single" COPY format
Date
Msg-id CAKFQuwYrwwgMzgAf45iubLbrFt-jTbMYLSrjzYo25+=5Fdaqfg@mail.gmail.com
Whole thread Raw
In response to Re: New "single" COPY format  ("Joel Jacobson" <joel@compiler.org>)
List pgsql-hackers
On Saturday, November 9, 2024, Joel Jacobson <joel@compiler.org> wrote:
On Sat, Nov 9, 2024, at 08:07, Joel Jacobson wrote:
> Here's a draft of an idea I'm considering (not yet implemented):

I realize the last part about optional quoting is unnecessary,
since if quoting is desired, users could just use the 'csv' format.

Revised draft of the idea (not yet implemented):

- Fast path for newline-free types:
For the list of built-in types where we know the ::text representation cannot
contain newlines, we take the fast path in NextCopyFromRawFields(),
pointing cstate->raw_fields[0] directly to cstate->line_buf.data.

- Handling newlines for other types:
For any other types, we would need to scan the string for newline characters.
If a newline is encountered, it results in an error.

Make sense to me.

David J.
 

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Proper object locking for GRANT/REVOKE
Next
From: "David G. Johnston"
Date:
Subject: Re: New "single" COPY format