Re: Passing parameters into an in-line psql invocation

Поиск
Список
Период
Сортировка
От John R Pierce
Тема Re: Passing parameters into an in-line psql invocation
Дата
Msg-id 4DE7DA99.1010609@hogranch.com
обсуждение исходный текст
Ответ на Passing parameters into an in-line psql invocation  ("Gauthier, Dave" <dave.gauthier@intel.com>)
Список pgsql-general
On 06/02/11 9:58 AM, Gauthier, Dave wrote:
>
> Hi:
>
> I'd like to pass a parameter into an inline psql call that itself
> calls an sql script, something like...
>
> psql mydb -c "\i thesqlscript foo"
>
> Where"foo" is the value I want to pass in.
>

on the psql command line,
     -v name=value
or
      --set name=value

then in your script, use :name if you want to use "value" as a sql
identifier and (in 9.x), you can use :'value'  if you want to use
'value' as a string literal.



--
john r pierce                            N 37, W 123
santa cruz ca                         mid-left coast


В списке pgsql-general по дате отправления:

Предыдущее
От: "Gauthier, Dave"
Дата:
Сообщение: Passing parameters into an in-line psql invocation
Следующее
От: Bosco Rama
Дата:
Сообщение: Re: Passing parameters into an in-line psql invocation