Re: New "single" COPY format

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Joel Jacobson <joel(at)compiler(dot)org>
Cc: Daniel Verite <daniel(at)manitou-mail(dot)org>, Aleksander Alekseev <aleksander(at)timescale(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: New "single" COPY format
Date: 2024-11-08 21:47:22
Message-ID: CAKFQuwY41K928EBkNi60MuF=N7kdSa7wHShZf25-q3spbUEtZA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 8, 2024 at 2:20 PM Joel Jacobson <joel(at)compiler(dot)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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2024-11-08 21:59:30 Re: UUID v7
Previous Message Tom Lane 2024-11-08 21:42:14 Draft back-branch release notes are up