Re: BUG #15535: psql: \copy: parse error at...

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #15535: psql: \copy: parse error at...
Дата
Msg-id 18991.1544022270@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #15535: psql: \copy: parse error at...  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы RE: BUG #15535: psql: \copy: parse error at...  ("Voillequin, Jean-Marc" <Jean-Marc.Voillequin@moodys.com>)
Re: BUG #15535: psql: \copy: parse error at...  ("Daniel Verite" <daniel@manitou-mail.org>)
Список pgsql-bugs
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Wednesday, December 5, 2018, Voillequin, Jean-Marc <
> Jean-Marc.Voillequin@moodys.com> wrote:
>> SIMPLE=> \copy (select * from /*comment with a closing parenthesis)*/
>> pg_tables) to 'test';
>> \copy: parse error at "*/"

> psql \copy doesn't understand comments.

More precisely, psql backslash commands in general have no provision
for comments.  Everything from the backslash to the end of the line
(or the next backslash command) is live command text.  If \copy had
a smarter parser for the embedded SELECT command, maybe that would
recognize SQL comments ... but it doesn't.

There was a proposal awhile back to provide a variant of \copy
that works more like \g, so you'd enter something like

COPY (SELECT ...) TO STDOUT
\copyto somefile

which'd be way more flexible --- the COPY command wouldn't have to
fit on one line, for one thing.  But I don't think that's gone
anywhere yet.

            regards, tom lane


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

Предыдущее
От: Pavlo Golub
Дата:
Сообщение: Re: BUG #15505: pgadmin 4
Следующее
От: "Voillequin, Jean-Marc"
Дата:
Сообщение: RE: BUG #15535: psql: \copy: parse error at...