Re: Emitting JSON to file using COPY TO

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Emitting JSON to file using COPY TO
Дата
Msg-id 398150.1701529880@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Emitting JSON to file using COPY TO  (Joe Conway <mail@joeconway.com>)
Ответы Re: Emitting JSON to file using COPY TO  (Nathan Bossart <nathandbossart@gmail.com>)
Re: Emitting JSON to file using COPY TO  (Hannu Krosing <hannuk@google.com>)
Список pgsql-hackers
Joe Conway <mail@joeconway.com> writes:
>> I noticed that, with the PoC patch, "json" is the only format that must be
>> quoted.  Without quotes, I see a syntax error.  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;
            }

So if you are writing a production that might need to match
FORMAT followed by JSON, you need to match FORMAT_LA too.

(I spent a little bit of time last week trying to get rid of
FORMAT_LA, thinking that it didn't look necessary.  Did not
succeed yet.)

            regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Joe Conway
Дата:
Сообщение: Re: Emitting JSON to file using COPY TO
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: about help message for new pg_dump's --filter option