Re: Interpolation of environment variables in SQL at runtime? - Mailing list pgsql-general

From Tom Lane
Subject Re: Interpolation of environment variables in SQL at runtime?
Date
Msg-id 27811.1099236666@sss.pgh.pa.us
Whole thread Raw
In response to Interpolation of environment variables in SQL at runtime?  (Andy Gimblett <A.M.Gimblett@swansea.ac.uk>)
List pgsql-general
Andy Gimblett <A.M.Gimblett@swansea.ac.uk> writes:
> Question: is there any way to use environment variables (or something
> similar) in my saved SQL code, and have them expanded at runtime?

Only by preprocessing the script.  Have you considered something like

cat <<EOF
... WHERE $foo = ...
EOF | psql ...

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: View's rule on delete problem
Next
From: Michael Fuhr
Date:
Subject: Re: View's rule on delete problem