From: | Michael Fork <mfork(at)toledolink(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | psql and shell scripts |
Date: | 2001-03-26 04:58:45 |
Message-ID: | Pine.BSI.4.21.0103252342290.6476-100000@glass.toledolink.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I am running the following command from a bash script:
/usr/local/pgsql/bin/psql -c "BEGIN; CREATE TEMP TABLE
radacct_archive_temp AS SELECT * FROM radacct_archive WHERE
date_part('month', tstamp) = ${RADACCT_MONTH} AND date_part('year',
tstamp) = ${RADACCT_YEAR}; UPDATE radacct_archive_te mp SET
framedipaddress = NULL WHERE framedipaddress = ''; COPY radacct_archive_t
emp TO '$COPY_RADACCT'; COMMIT;" $MAIN_DB
which produces this entry in the log file:
query: BEGIN; CREATE TEMP TABLE radacct_archive_temp AS SELECT * FROM
radacct_archive WHERE date_part('month', tstamp) = 06 AND
date_part('year', tstamp) = 2000; UPDATE radacct_archive_temp SET
framedipaddress = NULL WHERE framedipaddress = ''; COPY
radacct_archive_temp TO '/usr/local/pgsql/radius.R73573'; COMMIT;
which shows all of the variables have been properly substituted, leaving
(what appears to me) valid SQL.
However, the script produces the error:
ERROR: Relation 'radacct_archive_temp' does not exist
which doesn't make sense to me, as it is clearly created first, and inside
of a transaction. If I paste exactly what is in the log into a psql
window, it works as expected.
What am I missing (it has to be simple...)
Thanks!
Michael Fork - CCNA - MCP - A+
Network Support - Toledo Internet Access - Toledo Ohio
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-03-26 05:32:31 | Re: psql and shell scripts |
Previous Message | Ryan Kirkpatrick | 2001-03-26 03:49:56 | Re: Call for platforms |