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

From Michael Glaesemann
Subject Re: psql client: technique for applying default values to :variables?
Date
Msg-id 77ABDE37-069C-4467-BF6D-CC0402218BDB@myrealbox.com
Whole thread Raw
In response to Re: psql client: technique for applying default values to :variables?  (Jeff Boes <jeff@endpoint.com>)
Responses Re: psql client: technique for applying default values to :variables?  (Jeff Boes <jeff@endpoint.com>)
List pgsql-sql
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





pgsql-sql by date:

Previous
From: Jeff Boes
Date:
Subject: Re: psql client: technique for applying default values to :variables?
Next
From: Alexandre Gonçalves Jacarandá
Date:
Subject: select and as doubt