On Sat, Nov 9, 2024, at 15:13, David G. Johnston wrote:
> On Saturday, November 9, 2024, Joel Jacobson <j...@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.

Ops, the above should of course have said:
"we take the fast path in CopyAttributeOutList()".

>> - 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.

Cool. I've drafted a new patch on this approach.
The list of newline-free built-in types is not exhaustive, yet.

/Joel

Attachment: v20-0001-Introduce-CopyFormat-and-replace-csv_mode-and-binary.patch
Description: Binary data

Attachment: v20-0002-Add-COPY-format-list.patch
Description: Binary data

Attachment: v20-0003-Reorganize-option-validations.patch
Description: Binary data

Reply via email to