Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 2F351B5DC1C for ; Thu, 13 Oct 2011 23:13:11 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 48235-05 for ; Fri, 14 Oct 2011 02:13:04 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from momjian.us (momjian.us [70.90.9.53]) by mail.postgresql.org (Postfix) with ESMTP id CF2A8B5DC24 for ; Thu, 13 Oct 2011 23:13:04 -0300 (ADT) Received: (from bruce@localhost) by momjian.us (8.11.6/8.11.6) id p9E2D3R10837; Thu, 13 Oct 2011 22:13:03 -0400 (EDT) From: Bruce Momjian Message-Id: <201110140213.p9E2D3R10837@momjian.us> Subject: Re: psql's \copy incompatible with :variables In-Reply-To: <11634.1318558241@sss.pgh.pa.us> To: Tom Lane Date: Thu, 13 Oct 2011 22:13:03 -0400 (EDT) CC: Josh Berkus , pgsql-bugs@postgresql.org X-Mailer: ELM [version 2.4ME+ PL124 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="US-ASCII" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.404 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.504 X-Spam-Level: X-Archive-Number: 201110/115 X-Sequence-Number: 31385 Tom Lane wrote: > Bruce Momjian 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 http://momjian.us EnterpriseDB http://enterprisedb.com + It's impossible for everything to be true. +