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

From David G. Johnston
Subject Re: New "single" COPY format
Date
Msg-id CAKFQuwY41K928EBkNi60MuF=N7kdSa7wHShZf25-q3spbUEtZA@mail.gmail.com
Whole thread Raw
In response to Re: New "single" COPY format  ("Joel Jacobson" <joel@compiler.org>)
List pgsql-hackers
On Fri, Nov 8, 2024 at 2:20 PM Joel Jacobson <joel@compiler.org> wrote:

1. Text files containing \. in the middle of the file
% cat /tmp/test.txt
foo
\.
bar

Or another option to turn off the special meaning of \.?

This does seem like an orthogonal option worth considering.


> Besides, "single" as a format name does not sound right.
> Generally the name for a text format designates a set
> of characteristics meaning that certain combinations of
> characters have specific behaviors.
> Sometimes "plain" is used in the context of text formats
> to indicate that no character is special ("plain" is also the
> default subtype of "text" in MIME types).
>
> "single" as proposed is to be understood as "single-column",
> which is a consequence of the lack of a field delimiter, but
> not an intrinsic characteristic of the format.
> If COPY accepted fixed-length fields, it could be in a
> no-delimiter no-escape mode and still handle multiple
> columns, in opposition to what "single" suggests.

Good points. I agree "plain" is a better name.


I'm on board with a new named format that selects the desired defaults instead of requiring the user to know and change them all manually.

This seems to me like a "list" format.  Implying each row is a list entry.  Since we have tables the concept of list would likewise reasonably imply a single column.

Since newlines are special, i.e., record delimiters, "plain" thus would remain misleading.  It could be used for a case where the entire file is loaded into a new row, single column.

David J.

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Draft back-branch release notes are up
Next
From: Masahiko Sawada
Date:
Subject: Re: UUID v7