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

From Gauthier, Dave
Subject Passing parameters into an in-line psql invocation
Date
Msg-id 482E80323A35A54498B8B70FF2B87980049420A878@azsmsx504.amr.corp.intel.com
Whole thread Raw
Responses Re: Passing parameters into an in-line psql invocation
Re: Passing parameters into an in-line psql invocation
Re: Passing parameters into an in-line psql invocation
List pgsql-general

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.

 

Just as good would be the ability to sniff out an environment variable from within the sql script ("thesqlscript" in the example above).  In perl, I would use $ENV{VARNAME}.  Is there something like that in Postgres SQL?

 

V8.3.4 on Linux (upgrading to v9 very soon).

 

Thanks for any ideas !

pgsql-general by date:

Previous
From: John R Pierce
Date:
Subject: Re: Need suggestion
Next
From: John R Pierce
Date:
Subject: Re: Passing parameters into an in-line psql invocation