From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | jian he <jian(dot)universality(at)gmail(dot)com> |
Cc: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Joe Conway <mail(at)joeconway(dot)com>, Daniel Verite <daniel(at)manitou-mail(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Davin Shearer <davin(at)apache(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Emitting JSON to file using COPY TO |
Date: | 2024-01-31 13:26:28 |
Message-ID: | 202401311326.zvfydnpkqnnd@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
On 2024-Jan-23, jian he wrote:
> > + | FORMAT_LA copy_generic_opt_arg
> > + {
> > + $$ = makeDefElem("format", $2, @1);
> > + }
> > ;
> >
> > I think it's not necessary. "format" option is already handled in
> > copy_generic_opt_elem.
>
> test it, I found out this part is necessary.
> because a query with WITH like `copy (select 1) to stdout with
> (format json, force_array false); ` will fail.
Right, because "FORMAT JSON" is turned into FORMAT_LA JSON by parser.c
(see base_yylex there). I'm not really sure but I think it might be
better to make it "| FORMAT_LA JSON" instead of invoking the whole
copy_generic_opt_arg syntax. Not because of performance, but just
because it's much clearer what's going on.
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
From | Date | Subject | |
---|---|---|---|
Next Message | abrahim abrahao | 2024-01-31 19:05:19 | vacuum freeze wait_event BufferPin |
Previous Message | Junwang Zhao | 2024-01-31 09:58:00 | Re: Emitting JSON to file using COPY TO |
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander Kuzmenkov | 2024-01-31 13:37:28 | Re: Incorrect cost for MergeAppend |
Previous Message | Bharath Rupireddy | 2024-01-31 13:05:00 | Re: Introduce XID age and inactive timeout based replication slot invalidation |