From: | "Voillequin, Jean-Marc" <Jean-Marc(dot)Voillequin(at)moodys(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | RE: BUG #15535: psql: \copy: parse error at... |
Date: | 2018-12-05 15:21:57 |
Message-ID: | 1EC8157EB499BF459A516ADCF135ADCE3A007014@LON-WGMSX712.ad.moodys.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Wednesday, December 05, 2018 4:05 PM
To: David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Voillequin, Jean-Marc <Jean-Marc(dot)Voillequin(at)moodys(dot)com>; pgsql-bugs(at)lists(dot)postgresql(dot)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 sender and know the content is safe.
"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Wednesday, December 5, 2018, Voillequin, Jean-Marc <
> Jean-Marc(dot)Voillequin(at)moodys(dot)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
-----------------------------------------
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 not the intended recipient or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution or copying of this message, or any attachment thereto, in whole or in part, is strictly prohibited. If you have received this message 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 computer virus 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
-----------------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Verite | 2018-12-05 17:23:19 | Re: BUG #15535: psql: \copy: parse error at... |
Previous Message | Tom Lane | 2018-12-05 15:04:30 | Re: BUG #15535: psql: \copy: parse error at... |