Re: SQL select return into PSQL variables.

From: Reid Thompson <reid(dot)thompson(at)ateb(dot)com>
To: "Little, Douglas" <DOUGLAS(dot)LITTLE(at)orbitz(dot)com>
Cc: reid(dot)thompson(at)ateb(dot)com, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: SQL select return into PSQL variables.
Date: 2010-02-18 21:43:27
Message-ID: 1266529407.21987.0.camel@raker.ateb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 2010-02-18 at 09:33 -0600, Little, Douglas wrote:
> psql p1gp1 <<QUIT >>$LOGFile 2>&1
>
> \set ON_ERROR_STOP
>
> select da_test.QATestBuild(false)
>
> QUIT

mod to your needs...

$ cat dummy.sql
#MYTESTID=`psql -t -c "select da_test.QATestBuild(false)" dbname`
MYTS=`psql -t -c "select to_char(now(), 'YYYYMMDDHH24MISS')" test |sed 's/^ //'`
#echo "[$MYTS]"
fn=`basename $0`
LOGFile=${fn}_${MYTS}.log

psql test <<QUIT >>$LOGFile 2>&1

\set ON_ERROR_STOP

select * from stores;

QUIT

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Eric B. Ridge 2010-02-18 21:56:56 Re: GROUP BY column alias?
Previous Message Scott Bailey 2010-02-18 21:31:38 Re: GROUP BY column alias?