BUG #14493: psql command : Unable to use set with \copy

From: maxandreogeret(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #14493: psql command : Unable to use set with \copy
Date: 2017-01-12 09:47:50
Message-ID: 20170112094750.24292.7814@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14493
Logged by: Maxandre Ogeret
Email address: maxandreogeret(at)gmail(dot)com
PostgreSQL version: 9.4.1
Operating system: Redhat
Description:

Hello.

When launching a .sql file from batch script with psql command you can't
pass a variable with set.

batch file :
parameter=$1

psql -h XXX -U XXX -d XXX $@ --set foo=$parameter

SQL file :
\COPY ( SELECT * FROM table where id = :'foo') TO 'out.lst' WITH DELIMITER
AS '|' NULL AS 'ISNULL';

This won't work. but \qecho :'foo'

Will work.

Thanks for your reading.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2017-01-12 15:26:41 Re: BUG #14493: psql command : Unable to use set with \copy
Previous Message Amit Langote 2017-01-12 01:38:15 Re: Problem with declarative partitioning and COPY FROM