Re: Extend COPY FROM with HEADER <integer> to skip multiple lines

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Shinya Kato <shinya11(dot)kato(at)gmail(dot)com>
Cc: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>, Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Extend COPY FROM with HEADER <integer> to skip multiple lines
Date: 2025-07-03 06:32:45
Message-ID: 5248127c-d94a-4072-8647-1946687ebefb@oss.nttdata.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2025/07/03 11:08, Shinya Kato wrote:
> On Wed, Jul 2, 2025 at 4:48 PM Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> wrote:
>
>>>> Regarding the documentation, how about explicitly stating that when MATCH is specified, only
>>>> the first line is skipped? While this may seem obvious, it’s worth clarifying, as the semantics
>>>> of the HEADER option have become a bit more complex with this change.
>>>
>>> Agreed. I have updated the documentation as follows:
>>>
>>> + lines are discarded. If the option is set to <literal>MATCH</literal>,
>>> + the number and names of the columns in the header line must exactly
>>> + match those of the table and, in order, after which the header line is
>>> + discarded; otherwise an error is raised. The <literal>MATCH</literal>
>>
>> How about making the wording a bit clearer? For example:
>>
>> If set to MATCH, the first line is discarded, and it must contain column names that
>> exactly match the table's columns, in both number and order; otherwise, an error is raised.
>
> Thank you for the review. I fixed it.

Thanks for updating the patch! I've pushed the patch.

>> Also, the phrase "if this option is set to..." is repeated three times in the current text.
>> For the second and third instances, we could simplify it to just "if set to...".
>
> Agreed. However, for the sake of symmetry between "On output" and "On
> input" and to maintain clarity between the paragraphs, I have omitted
> "this option is" from the "On input" paragraph only.

Yes, I agree that's better.

Regards,

--
Fujii Masao
NTT DATA Japan Corporation

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2025-07-03 06:34:33 Re: Using failover slots for PG-non_PG logical replication
Previous Message shveta malik 2025-07-03 06:32:43 Re: POC: enable logical decoding when wal_level = 'replica' without a server restart