Re: psql's \copy incompatible with :variables

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: psql's \copy incompatible with :variables
Date: 2011-10-14 01:39:17
Message-ID: 201110140139.p9E1dHN00659@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Josh Berkus wrote:
> Summary: \copy interprets psql's :variables as literal strings
>
> Tested On: 8.4.4, 9.0.4
>
> Severity: Annoyance
>
> Steps to Reproduce:
>
> psql
>
> \set filename 'test.csv'
>
> \copy pg_class to :filename with csv
>
> \q
>
> ls
>
> :filename
>
> Note that psql variables work perfectly fine with COPY. It's just \copy
> which seems to be misbehaving.

The problem is that none of the backslash commands interpret variables:

test=> \set x '''y'''
test=> select :x;
?column?
----------
y
(1 row)

test=> \d :y
Did not find any relation named ":y".

Should they?

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2011-10-14 02:10:41 Re: psql's \copy incompatible with :variables
Previous Message Bruce Momjian 2011-10-14 01:37:03 Re: Re: BUG #6050: Dump and restore of view after a schema change: can't restore the view