Re: psql's \copy incompatible with :variables - Mailing list pgsql-bugs

From Bruce Momjian
Subject Re: psql's \copy incompatible with :variables
Date
Msg-id 201110140213.p9E2D3R10837@momjian.us
Whole thread Raw
In response to Re: psql's \copy incompatible with :variables  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > Josh Berkus wrote:
> >> 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:
>
> Nonsense.
>
> regression=# \set foo bar
> regression=# \d foo
> Did not find any relation named "foo".
> regression=# \d :foo
> Did not find any relation named "bar".
>
> \copy is different because it uses OT_WHOLE_LINE mode to read the
> argument, and that doesn't expand :variable references.  I'd be a bit
> leery of changing that.

Oh, I see.  My tests were wrong.  Thanks.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: psql's \copy incompatible with :variables
Next
From: "Vishnu S."
Date:
Subject: Re: Tablespace files deleted in continuous run