Re: psql scripting tutorials - Mailing list pgsql-general

From Roderick A. Anderson
Subject Re: psql scripting tutorials
Date
Msg-id 48C94F47.7070002@acm.org
Whole thread Raw
In response to Re: psql scripting tutorials  (Kevin Hunter <hunteke@earlham.edu>)
Responses Re: psql scripting tutorials  (Michelle Konzack <linux4michelle@tamay-dogan.net>)
List pgsql-general
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
>


pgsql-general by date:

Previous
From: "Gauthier, Dave"
Date:
Subject: connection timeouts and "killing" users
Next
From: aklaver@comcast.net (Adrian Klaver)
Date:
Subject: Re: psql scripting tutorials