pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Glaesemann <grzm@myrealbox.com>
To: Jeff Boes <jeff@endpoint.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: psql client: technique for applying default values to :variables?
Date: Sun, 15 Jan 2006 07:38:39 +0900
Message-ID: <77ABDE37-069C-4467-BF6D-CC0402218BDB@myrealbox.com> (raw)
In-Reply-To: <43C910B6.9080904@endpoint.com>
References: <43C55316.60403@endpoint.com>
	<6d8daee30601111551y68b2663ek6484c830f2107bee@mail.gmail.com>
	<43C910B6.9080904@endpoint.com>


On Jan 14, 2006, at 23:54 , Jeff Boes wrote:

> Tony Wasson wrote:

>> Stuff like this works for me in a SQL file.... \set edate  
>> 'CURRENT_DATE::DATE' SELECT * FROM some_table WHERE update_date  
>> = :edate;
>
> Sure, but that was not my question. I want to be able to set the  
> variable on the command line, BUT have it default to a value inside  
> the SQL script if not present on the command line.

You could write a wrapper script that would accept a command line  
argument and load the file with the appropriate SET statement prepended.

Michael Glaesemann
grzm myrealbox com






view thread (6+ messages)  latest in thread

Message-ID: <77ABDE37-069C-4467-BF6D-CC0402218BDB@myrealbox.com>
Permalink:  ../77ABDE37-069C-4467-BF6D-CC0402218BDB@myrealbox.com/
Also on:    postgresql.org/message-id/77ABDE37-069C-4467-BF6D-CC0402218BDB@myrealbox.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: grzm@myrealbox.com, jeff@endpoint.com
  Subject: Re: psql client: technique for applying default values to :variables?
  In-Reply-To: <77ABDE37-069C-4467-BF6D-CC0402218BDB@myrealbox.com>
  References: <43C55316.60403@endpoint.com> <6d8daee30601111551y68b2663ek6484c830f2107bee@mail.gmail.com> <43C910B6.9080904@endpoint.com> <77ABDE37-069C-4467-BF6D-CC0402218BDB@myrealbox.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