public inbox for [email protected]
help / color / mirror / Atom feedFrom: Hannu Krosing <[email protected]>
To: Tom Lane <[email protected]>
Cc: Joe Conway <[email protected]>
Cc: Nathan Bossart <[email protected]>
Cc: Davin Shearer <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Subject: Re: Emitting JSON to file using COPY TO
Date: Sat, 9 Dec 2023 12:56:23 +0100
Message-ID: <CAMT0RQScQz_+nUnC4WSmkVN4KZTJMBYAFcDOn2F8gW57pP_D9w@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CALvfUkBxTYy5uWPFVwpk_7ii2zgT07t3d-yR_cy4sfrrLU=kcg@mail.gmail.com>
<[email protected]>
<CAFCRh-_LhP5Ln4-beVz=1pQ9VycU3hAxnJHXhPHZRmX0BSCVEQ@mail.gmail.com>
<CAFCRh--Vhx0105S7SWAYHGcVMTSRtbcoArDUGSbYSWRUGunW_g@mail.gmail.com>
<CAKFQuwZb3zaSqkOvGXRRLZEW61az+4xyHZ7tBPR91JfrcdCKvA@mail.gmail.com>
<[email protected]>
<CAFCRh-_GdiUvjd5z5FfvTfhruOnYqBu163XU47zZE8RNATCJGQ@mail.gmail.com>
<[email protected]>
<CALvfUkCq3pvkmniWEKZwkbA6hNNvkANF3OamMfhC170RgY+HJg@mail.gmail.com>
<[email protected]>
<20231201230958.GA1786735@nathanxps13>
<[email protected]>
<[email protected]>
>
On Sat, Dec 2, 2023 at 4:11 PM Tom Lane <[email protected]> wrote:
>
> Joe Conway <[email protected]> writes:
> >> I noticed that, with the PoC patch, "json" is the only format that must be
> >> quoted. Without quotes, I see a syntax error.
In longer term we should move any specific COPY flag names and values
out of grammar and their checking into the parts that actually
implement whatever the flag is influencing
Similar to what we do with OPTIONS in all levels of FDW definitions
(WRAPPER itself, SERVER, USER MAPPING, FOREIGN TABLE)
[*] https://www.postgresql.org/docs/current/sql-createforeigndatawrapper.html
> >> I'm assuming there's a
> >> conflict with another json-related rule somewhere in gram.y, but I haven't
> >> tracked down exactly which one is causing it.
>
> While I've not looked too closely, I suspect this might be due to the
> FORMAT_LA hack in base_yylex:
>
> /* Replace FORMAT by FORMAT_LA if it's followed by JSON */
> switch (next_token)
> {
> case JSON:
> cur_token = FORMAT_LA;
> break;
> }
My hope is that turning the WITH into a fully independent part with no
grammar-defined keys or values would also solve the issue of quoting
"json".
For backwards compatibility we may even go the route of keeping the
WITH as is but add the OPTIONS which can take any values at grammar
level.
I shared my "Pluggable Copy " talk slides from Berlin '22 in another thread
--
Hannu
view thread (2+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: Emitting JSON to file using COPY TO
In-Reply-To: <CAMT0RQScQz_+nUnC4WSmkVN4KZTJMBYAFcDOn2F8gW57pP_D9w@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox