pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Boes <jeff@endpoint.com>
To: pgsql-sql@postgresql.org
Subject: psql client: technique for applying default values to :variables?
Date: Wed, 11 Jan 2006 13:48:54 -0500
Message-ID: <43C55316.60403@endpoint.com> (raw)

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




view thread (6+ messages)  latest in thread

Message-ID: <43C55316.60403@endpoint.com>
Permalink:  ../43C55316.60403@endpoint.com/
Also on:    postgresql.org/message-id/43C55316.60403@endpoint.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jeff@endpoint.com
  Subject: Re: psql client: technique for applying default values to :variables?
  In-Reply-To: <43C55316.60403@endpoint.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox