Re: psql \echo strangeness with :variables

From: ptjm(at)interlog(dot)com (Patrick TJ McPhee)
To: pgsql-general(at)postgresql(dot)org
Subject: Re: psql \echo strangeness with :variables
Date: 2006-05-25 04:38:16
Message-ID: 4dkqloF1a6g4aU1@uni-berlin.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In article <m3ejyjp2d8(dot)fsf(at)prod01(dot)jerrysievers(dot)com>,
Jerry Sievers <jerry(at)jerrysievers(dot)com> wrote:

% jsievers(at)jsievers#
% = \set date `date '+%Y%m%d'`
%
% jsievers(at)jsievers#
% = \echo :date
% 20060524
%
% jsievers(at)jsievers#
% = \echo foo_:date
% foo_:date <-- Was expecting this to expand... see below

variables need to be space-delimited in \ contexts. Work-around:

\set tn 'foo_' :date
\echo :tn
create table :tn();

--

Patrick TJ McPhee
North York Canada
ptjm(at)interlog(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Ben-Nes 2006-05-25 05:51:48 Re: I dont get it,
Previous Message Chris 2006-05-25 03:55:00 Re: New DBs from existing schemas