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

Поиск
Список
Период
Сортировка
От Michael Glaesemann
Тема Re: psql client: technique for applying default values to :variables?
Дата
Msg-id 77ABDE37-069C-4467-BF6D-CC0402218BDB@myrealbox.com
обсуждение исходный текст
Ответ на Re: psql client: technique for applying default values to :variables?  (Jeff Boes <jeff@endpoint.com>)
Ответы Re: psql client: technique for applying default values to :variables?  (Jeff Boes <jeff@endpoint.com>)
Список 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 по дате отправления:

Предыдущее
От: Jeff Boes
Дата:
Сообщение: Re: psql client: technique for applying default values to :variables?
Следующее
От: Alexandre Gonçalves Jacarandá
Дата:
Сообщение: select and as doubt