Re: Allow COPY's 'text' format to output a header

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: "Simon Muller" <samullers(at)gmail(dot)com>
Cc: "Cynthia Shang" <cynthia(dot)shang(at)crunchydata(dot)com>,pgsql-hackers(at)postgresql(dot)org
Subject: Re: Allow COPY's 'text' format to output a header
Date: 2018-08-01 14:20:02
Message-ID: 27e168b6-6305-4c7b-a969-523998b0827f@manitou-mail.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2018-08-01 14:21:55 Re: Explain buffers wrong counter with parallel plans
Previous Message Petr Jelinek 2018-08-01 14:13:39 Re: patch to ensure logical decoding errors early