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

Поиск
Список
Период
Сортировка
От Voillequin, Jean-Marc
Тема RE: BUG #15535: psql: \copy: parse error at...
Дата
Msg-id 1EC8157EB499BF459A516ADCF135ADCE3A007014@LON-WGMSX712.ad.moodys.net
обсуждение исходный текст
Ответ на Re: BUG #15535: psql: \copy: parse error at...  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
My select statement to export was a 26K chars with several /* */ comments, and I could not imagine such issue.

Thank you guys.


-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Wednesday, December 05, 2018 4:05 PM
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Voillequin, Jean-Marc <Jean-Marc.Voillequin@moodys.com>; pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15535: psql: \copy: parse error at...



CAUTION: This email originated from outside of Moody's. Do not click links or open attachments unless you recognize the
senderand know the content is safe. 



"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
theend of the line (or the next backslash command) is live command text.  If \copy had a smarter parser for the
embeddedSELECT 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'sgone anywhere yet. 

            regards, tom lane

-----------------------------------------

Moody's monitors email communications through its networks for regulatory compliance purposes and to protect its
customers,employees and business and where allowed to do so by applicable law. The information contained in this e-mail
message,and any attachment thereto, is confidential and may not be disclosed without our express permission. If you are
notthe intended recipient or an employee or agent responsible for delivering this message to the intended recipient,
youare hereby notified that you have received this message in error and that any review, dissemination, distribution or
copyingof this message, or any attachment thereto, in whole or in part, is strictly prohibited. If you have received
thismessage in error, please immediately notify us by telephone, fax or e-mail and delete the message and all of its
attachments.Every effort is made to keep our network free from viruses. You should, however, review this e-mail
message,as well as any attachment thereto, for viruses. We take no responsibility and have no liability for any
computervirus which may be transferred via this e-mail message. 

This email was sent to you by Moody’s Investors Service EMEA Limited
Registered office address:
One Canada Square
Canary Wharf
London, E14 5FA
Registered in England and Wales No: 8922701

-----------------------------------------

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #15535: psql: \copy: parse error at...
Следующее
От: "Daniel Verite"
Дата:
Сообщение: Re: BUG #15535: psql: \copy: parse error at...