psql access of user's environmental variables

Поиск
Список
Период
Сортировка
От Paul Tilles
Тема psql access of user's environmental variables
Дата
Msg-id 4639D921.7080101@noaa.gov
обсуждение исходный текст
Ответы Re: psql access of user's environmental variables  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
I need to use the value of an environment variable as part of an SQL
query within psql.

I can do the following withing psql:

\set  local_site  `echo  $FXA_LOCAL_SITE

\echo  local site =  :local_site

The result is "local_site = xxx"  which is correct.

What I really want to do is the following:

\set  local_site  `echo  $FXA_LOCAL_SITE

UPDATE  table_name  SET  office_id =  :local_site;

This results in the message

               column  "xxx" does not exist

Is there any way that I can use the value of the FXA_LOCAL_SITE env
variable in my UPDATE statement?

Paul Tilles



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

Предыдущее
От: "Dan Weber"
Дата:
Сообщение: Re: forcing use of a specific (expression) index?
Следующее
От: Stephen Harris
Дата:
Сообщение: Re: Have I b0rked something? Slow comparisons on "where x in (...)"