On Thu, Oct 15, 2009 at 4:37 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Another possibility that should be mentioned for the record is that
> we could special-case the appname parameter inside libpq, so that the
> environment variable takes precedence over the conn setting instead
> of the other way round. That seems pretty ugly too, but maybe it's
> the least bad answer, if we decide that most apps need that precedence.
Looking further, I think this might be quite clean:
- Add a precedence flag to PQconninfoOption
- In conninfo_parse, in the section that grabs the envvars for empty
params, modify the logic to override any existing values if a value is
set in the environment and the precedence flag is set for that option.
That may be useful in the future for other options, and will certainly
be less ugly than special casing one setting.
--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com