Re: psql access of user's environmental variables

Поиск
Список
Период
Сортировка
От Paul Tilles
Тема Re: psql access of user's environmental variables
Дата
Msg-id 4639FB9E.8070607@noaa.gov
обсуждение исходный текст
Ответ на Re: psql access of user's environmental variables  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Tom,
Thank you. That works.

My psql does not allow me to leave off the trailing `.

It is my typing that is the problem.

Paul

Tom Lane wrote:
> Paul Tilles <Paul.Tilles@noaa.gov> writes:
>
>> 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
>>
>
> Yes, because you have no quotes in the value of the variable, so that
> update looks to the server like
>     UPDATE  table_name  SET  office_id =  xxx;
>
> After some fooling around, the easiest way to get the needed quotes is
> to embed them in the echo result:
>
> \set local_site `echo "'$FXA_LOCAL_SITE'"`
>
> BTW, does your psql really let you leave off the trailing ` like
> that?  Mine doesn't.
>
>             regards, tom lane
>

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

Предыдущее
От: Alban Hertroys
Дата:
Сообщение: Re: Update violating constraint
Следующее
От: "Hakan Kocaman"
Дата:
Сообщение: Re: Stored procedure