From: | Vick Khera <vivek(at)khera(dot)org> |
---|---|
To: | "Little, Douglas" <DOUGLAS(dot)LITTLE(at)orbitz(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: SQL select return into PSQL variables. |
Date: | 2010-02-18 15:48:50 |
Message-ID: | 2968dfd61002180748y4b6a13b9wf3f843c69619560@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Feb 18, 2010 at 10:33 AM, Little, Douglas <DOUGLAS(dot)LITTLE(at)orbitz(dot)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]%
From | Date | Subject | |
---|---|---|---|
Next Message | Carsten Kropf | 2010-02-18 16:22:31 | Re: Trying to add a type modifier to user created type |
Previous Message | Tom Lane | 2010-02-18 15:46:46 | Re: Trying to add a type modifier to user created type |