Re: BUG #16639: Syntax error in pgsql when executing local \copy instead of SQL copy - Mailing list pgsql-bugs

From hubert depesz lubaczewski
Subject Re: BUG #16639: Syntax error in pgsql when executing local \copy instead of SQL copy
Date
Msg-id 20200928134610.GA9565@depesz.com
Whole thread Raw
In response to BUG #16639: Syntax error in pgsql when executing local \copy instead of SQL copy  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
On Mon, Sep 28, 2020 at 01:25:08PM +0000, PG Bug reporting form wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      16639
> Logged by:          Hans Buschmann
> Email address:      buschmann@nidsa.net
> PostgreSQL version: 13.0
> Operating system:   Linux x64 or Windows 64bit
> Description:        
> 
> Deriving from a much longer query in our application I managed to extract a
> short query which shows the error for $subject:
> 
> 
> \copy (
> with

\copy is psql command, and has to be in single line.

You can see it by entering:

\copy (

and then pressing enter in psql.

Docs mention:

>> Another way to obtain the same result as \copy ... to is to use the SQL COPY
>> ... TO STDOUT command and terminate it with \g filename or \g |program. Unlike
>> \copy, this method allows the command to span multiple lines; also, variable
>> interpolation and backquote expansion can be used.

Best regards,

depesz




pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #16639: Syntax error in pgsql when executing local \copy instead of SQL copy
Next
From: PG Bug reporting form
Date:
Subject: BUG #16640: Documentation table formatting issue