From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "David G(dot) 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" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: BUG #15535: psql: \copy: parse error at... |
Date: | 2018-12-05 15:04:30 |
Message-ID: | 18991.1544022270@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
"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
From | Date | Subject | |
---|---|---|---|
Next Message | Voillequin, Jean-Marc | 2018-12-05 15:21:57 | RE: BUG #15535: psql: \copy: parse error at... |
Previous Message | Pavlo Golub | 2018-12-05 14:35:46 | Re: BUG #15505: pgadmin 4 |