On 06/02/11 9:58 AM, Gauthier, Dave wrote:

Hi:

I'd like to pass a parameter into an inline psql call that itself calls an sql script, something like...

psql mydb -c "\i thesqlscript foo"

Where"foo" is the value I want to pass in.


on the psql command line,
    -v name=value
or
     --set name=value

then in your script, use :name if you want to use "value" as a sql identifier and (in 9.x), you can use :'value' if you want to use 'value' as a string literal.



--
john r pierce                            N 37, W 123
santa cruz ca                         mid-left coast


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to