Re: psql scripting tutorials

From: aklaver(at)comcast(dot)net (Adrian Klaver)
To: "Roderick A(dot) Anderson" <raanders(at)acm(dot)org>
Cc: Postgres General List <pgsql-general(at)postgresql(dot)org>
Subject: Re: psql scripting tutorials
Date: 2008-09-11 17:10:42
Message-ID: 091120081710.2802.48C951120001491600000AF222069997359D0A900E04050E@comcast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-------------- Original message ----------------------
From: "Roderick A. Anderson" <raanders(at)acm(dot)org>
> Kevin Hunter wrote:
> > At 7:13am -0400 on Thu, 11 Sep 2008, Harald Fuchs wrote:
> >> Nice trick, but when I try the following variant:
> >>
> >> psql -v TEST=16 -c 'select :TEST as "input"'
> >>
> >> I get [a syntax error]
> >
> >> This seems to be contrary to the psql manual page:
> >
> > Nope. Take a look at the -c option. Specifically "Thus you cannot mix
> > SQL and psql meta-commands with this option."
> >
> > You might try shell interpretation:
> >
> > $ TEST=16; psql -c "select $TEST as \"input1\";"
> > $ TEST=16; echo "select $TEST as \"input1\";" | psql
>
> Whatever happened to pgbash? I see the last update was Feb 2003 but
> that was for Pg v7.3.
>
>
> Rod
> --
> >
> > Kevin
> >
>
>

See also:
http://www.edlsystems.com/shellsql/
http://pgfoundry.org/projects/plsh/
--
Adrian Klaver
aklaver(at)comcast(dot)net

Browse pgsql-general by date

  From Date Subject
Next Message Alan Hodgson 2008-09-11 17:15:28 Re: "Healing" a table after massive updates
Previous Message Roderick A. Anderson 2008-09-11 17:03:03 Re: psql scripting tutorials