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

From: Michael Glaesemann <grzm(at)myrealbox(dot)com>
To: Jeff Boes <jeff(at)endpoint(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: psql client: technique for applying default values to :variables?
Date: 2006-01-14 22:38:39
Message-ID: 77ABDE37-069C-4467-BF6D-CC0402218BDB@myrealbox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Alexandre Gonçalves Jacarandá 2006-01-15 03:55:33 select and as doubt
Previous Message Jeff Boes 2006-01-14 14:54:46 Re: psql client: technique for applying default values to :variables?