Re: Extend COPY FROM with HEADER to skip multiple lines - Mailing list pgsql-hackers

From Shinya Kato
Subject Re: Extend COPY FROM with HEADER to skip multiple lines
Date
Msg-id CAOzEurTkE=rDmoEpkJE_8Um6a8baMrmr36ucfgr0izdRiN8a=A@mail.gmail.com
Whole thread Raw
In response to Re: Extend COPY FROM with HEADER to skip multiple lines  (Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>)
List pgsql-hackers
On Tue, Jun 10, 2025 at 7:05 PM Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> wrote:
Andrew Dunstan <andrew@dunslane.net> writes:

> OTOH I'm a bit curious to know what software produces multi-line CSV
> headers.

AWS CloudFront access logs are stored in S3 as TSV files (one per hour
per CF node) with a two-line header comment where the first line is the
version and the second lists the fields (but not in a form useful for
HEADER MATCH).

Thank you for providing that example.
 
Although not useful for the above format, and not intended to derail or
bloat the proposal in this thread, would it be useful to have a mode
that combines skip and match?  I.e. skip N lines, then check the fields
in the one after that against the target columns.

I think it would be useful, but the target columns are not always at the bottom of the header. For example, the target columns could be on the first line, with explanations or sub-columns on the lines that follow.

Considering this, the patch would become too complicated, so I'd like to keep this out of scope. What do you think?

--
Best regards,
Shinya Kato
NTT OSS Center

pgsql-hackers by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: Proposal: Global Index for PostgreSQL
Next
From: Fujii Masao
Date:
Subject: Re: Extend ALTER DEFAULT PRIVILEGES for large objects