Search Postgresql Archives

Re: Passing parameters into an in-line psql invocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux