psql client: technique for applying default values to :variables?

From: Jeff Boes <jeff(at)endpoint(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: psql client: technique for applying default values to :variables?
Date: 2006-01-11 18:48:54
Message-ID: 43C55316.60403@endpoint.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Stumped: is there any way to set up default values for psql variables
within the .SQL file itself? Obviously, I can do something like:

$ psql -f my_script -v MYVAR=${myvar:-mydefault}

but I would prefer to have the value stored with the .SQL file, e.g. (if
this actually worked):

\set MYVAR COALESCE(:MYVAR,'mydefault')

--
Jeffery Boes <><
jeff(at)endpoint(dot)com

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Mauricio Fernandez A. 2006-01-11 20:07:40 Re: Unable to identify an ordering operator '<' for type 'smallint[]'
Previous Message Tom Lane 2006-01-11 18:24:31 Re: Unable to identify an ordering operator '<' for type 'smallint[]'