Re: Passing parameters into an in-line psql invocation - Mailing list pgsql-general

From John R Pierce
Subject Re: Passing parameters into an in-line psql invocation
Date
Msg-id 4DE7DA99.1010609@hogranch.com
Whole thread Raw
In response to Passing parameters into an in-line psql invocation  ("Gauthier, Dave" <dave.gauthier@intel.com>)
List pgsql-general
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


pgsql-general by date:

Previous
From: "Gauthier, Dave"
Date:
Subject: Passing parameters into an in-line psql invocation
Next
From: Bosco Rama
Date:
Subject: Re: Passing parameters into an in-line psql invocation