psql client: technique for applying default values to :variables? - Mailing list pgsql-sql

From Jeff Boes
Subject psql client: technique for applying default values to :variables?
Date
Msg-id 43C55316.60403@endpoint.com
Whole thread Raw
Responses Re: psql client: technique for applying default values to :variables?  (Tony Wasson <ajwasson@gmail.com>)
List 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@endpoint.com



pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: Unable to identify an ordering operator '<' for type 'smallint[]'
Next
From: "Mauricio Fernandez A."
Date:
Subject: Re: Unable to identify an ordering operator '<' for type 'smallint[]'