Re: SQL select return into PSQL variables.

Поиск
Список
Период
Сортировка
От Vick Khera
Тема Re: SQL select return into PSQL variables.
Дата
Msg-id 2968dfd61002180748y4b6a13b9wf3f843c69619560@mail.gmail.com
обсуждение исходный текст
Ответ на SQL select return into PSQL variables.  ("Little, Douglas" <DOUGLAS.LITTLE@orbitz.com>)
Список pgsql-general
On Thu, Feb 18, 2010 at 10:33 AM, Little, Douglas <DOUGLAS.LITTLE@orbitz.com> wrote:

psql

orbitz=# \!testvar=1234

orbitz=# \!export testvar

orbitz=# \!echo $testvar

1234

orbitz=# \q

-bash-3.00$ echo $testvar                                                                                                                                    

1234

What shell are you using that allows a child process to alter the parent process' environment?  ohhhhh. you must be on windows....  this is not normal unix behavior: the child process (psql) cannot alter the parent (shell) environment, and every \! command you run fires a new subshell.  On unix you see this:

[yertle]% psql
Timing is on.
Welcome to psql 8.3.9 (server 8.3.7), the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

khera=> \!testvar=1234
khera=> \!export testvar
khera=> \!echo $testvar

khera=> \q
[yertle]% echo $testvar
testvar: Undefined variable.
[yertle]% 

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Trying to add a type modifier to user created type
Следующее
От: Carsten Kropf
Дата:
Сообщение: Re: Trying to add a type modifier to user created type