Passing parameters into an in-line psql invocation

Поиск
Список
Период
Сортировка
От Gauthier, Dave
Тема Passing parameters into an in-line psql invocation
Дата
Msg-id 482E80323A35A54498B8B70FF2B87980049420A878@azsmsx504.amr.corp.intel.com
обсуждение исходный текст
Ответы Re: Passing parameters into an in-line psql invocation  (John R Pierce <pierce@hogranch.com>)
Re: Passing parameters into an in-line psql invocation  (Bosco Rama <postgres@boscorama.com>)
Re: Passing parameters into an in-line psql invocation  (Leif Biberg Kristensen <leif@solumslekt.org>)
Список pgsql-general

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.

 

Just as good would be the ability to sniff out an environment variable from within the sql script ("thesqlscript" in the example above).  In perl, I would use $ENV{VARNAME}.  Is there something like that in Postgres SQL?

 

V8.3.4 on Linux (upgrading to v9 very soon).

 

Thanks for any ideas !

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

Предыдущее
От: John R Pierce
Дата:
Сообщение: Re: Need suggestion
Следующее
От: John R Pierce
Дата:
Сообщение: Re: Passing parameters into an in-line psql invocation