Re: Allow COPY's 'text' format to output a header - Mailing list pgsql-hackers

From Daniel Verite
Subject Re: Allow COPY's 'text' format to output a header
Date
Msg-id 27e168b6-6305-4c7b-a969-523998b0827f@manitou-mail.org
Whole thread Raw
In response to Re: Allow COPY's 'text' format to output a header  (Simon Muller <samullers@gmail.com>)
Responses Re: Allow COPY's 'text' format to output a header
List pgsql-hackers
  Simon Muller wrote:

> I've incorporated both your suggestions and included the patch you provided
> in the attached patch. Hope it's as expected.

Still unconvinced about the use case, since COPY's text format is only
meant to be consumed by Postgres, and the only way that Postgres will
consume this header is to discard it (at least as of the current
patch). But anyway...

   /* Check header */
-  if (!cstate->csv_mode && cstate->header_line)
+  if (cstate->binary && cstate->header_line)
     ereport(ERROR,
-  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-    errmsg("COPY HEADER available only in CSV mode")));
+     (errcode(ERRCODE_SYNTAX_ERROR),
+      errmsg("cannot specify HEADER in BINARY mode")));

Why should ERRCODE_FEATURE_NOT_SUPPORTED become ERRCODE_SYNTAX_ERROR?

Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite


pgsql-hackers by date:

Previous
From: Petr Jelinek
Date:
Subject: Re: patch to ensure logical decoding errors early
Next
From: Robert Haas
Date:
Subject: Re: Explain buffers wrong counter with parallel plans