On Thu, Feb 18, 2010 at 10:33 AM, Little, Douglas <DOUGLAS.LITTLE@xxxxxxxxxx> wrote:
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:psql
orbitz=# \!testvar=1234
orbitz=# \!export testvar
orbitz=# \!echo $testvar
1234
orbitz=# \q
-bash-3.00$ echo $testvar
1234
[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]%