| From: | Mariyan Clement S <softclement(at)gmail(dot)com> |
|---|---|
| To: | Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com> |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: PostgreSQL 19 Beta 2: COPY HEADER N exceeds file length - test observation |
| Date: | 2026-08-14 11:23:54 |
| Message-ID: | CAA3hCqg3KScapU1jE9o4G68pvt=GbQ=kshHobJbFUSDKyoaB9Q@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Matthias,
Thank you for the clarification.
Yes, I agree with your interpretation. My intention was not to suggest that
the current behavior is necessarily a bug.
The test file was intentionally constructed with metadata lines before the
CSV header to simulate a real-world batch/export file. I understand that
such a file is not a conventional RFC 4180-compliant CSV file.
My main observation was about the case where the configured HEADER value is
greater than the number of available input lines.
As you pointed out, the documentation clearly states that when HEADER is
specified with a non-negative integer, that number of lines are discarded.
Therefore, consuming the available input and returning COPY 0 is consistent
with the documented behavior.
I wanted to validate this edge case during PostgreSQL 19 Beta testing,
particularly from an ETL perspective where the HEADER value could
potentially be supplied through external configuration and could be
incorrect.
Thanks again for taking the time to clarify this.
Regards,
Mariyan Clement
Database Architect | PostgreSQL | Oracle
LinkedIn: https://www.linkedin.com/in/mariyanclement/
On Fri, Aug 14, 2026 at 4:16 PM Matthias van de Meent <
boekewurm+postgres(at)gmail(dot)com> wrote:
> On Thu, 13 Aug 2026 at 21:12, Mariyan Clement S <softclement(at)gmail(dot)com>
> wrote:
> >
> > Hi PostgreSQL community,
> >
> > I have been testing the new integer form of the COPY FROM HEADER option
> in PostgreSQL 19 Beta 2 and wanted to share an edge-case observation for
> confirmation.
> >
> > I tested a CSV file containing only 5 lines:
> >
> > 3 metadata lines
>
> So, it's not really a CSV file, or at least not compliant with the
> relevant RFC 4180?
>
> > Could someone please confirm whether this is the expected/intended
> behavior for HEADER ?
>
> The docs are clear: "HEADER [...] On input, [i]f set to a non-negative
> integer, that number of lines are discarded."
> Unless you suggest we raise an error when the input file doesn't
> contain at least as many lines as indicated by the user's integer
> input to HEADER, the behaviour of ignoring lines indicated by the user
> to be headers is fully expected.
>
>
> Kind regards,
>
> Matthias van de Meent
> Databricks (https://www.databricks.com)
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andrey Borodin | 2026-08-14 11:39:24 | Re: Checkpointer write combining |
| Previous Message | Matthias van de Meent | 2026-08-14 10:46:36 | Re: PostgreSQL 19 Beta 2: COPY HEADER N exceeds file length - test observation |