Joe Conway <mail(at)joeconway(dot)com> writes:
> On 02/02/2010 06:10 PM, Tom Lane wrote:
>> We should also give more than zero thought to how values coming from the
>> expanded dbname should interact with values from other arguments to
>> PQconnectdbParams --- which should override which? And should there be
>> an order dependency?
> My first thought was to duplicate the logic used by PQsetdbLogin(). It
> uses the conninfo string, fills in the defaults using connectOptions1(),
> applies the supplied other arguments overriding the defaults, and then
> finally computes derived options with connectOptions2(). It is
> essentially the same as PQconnectdb() except the supplied parameters are
> used before setting the derived options.
The difference with PQconnectdbParams is that the dbname might not be
the first thing in the parameter array. I think that a straightforward
implementation would have the effect of the expanded dbname overriding
parameters given before it, but not those given after it. Consider
keyword[0] = "port";
values[0] = "5678";
keyword[1] = "dbname";
values[1] = "dbname = db user = foo port = 9999";
keyword[2] = "user";
values[2] = "uu";
What I'm imagining is that this would end up equivalent to
dbname = db user = uu port = 9999. That's probably reasonable,
and maybe even useful, as long as it's documented.
regards, tom lane
In response to
Responses
pgsql-hackers by date
| Next: | From: Alex Hunsaker | Date: 2010-02-03 03:42:21 |
| Subject: Re: Add on_trusted_init and on_untrusted_init to plperl UPDATED [PATCH] |
| Previous: | From: Joe Conway | Date: 2010-02-03 02:25:27 |
| Subject: Re: BUG #5304: psql using conninfo fails in connecting to
the server |
pgsql-bugs by date
| Next: | From: Chris Travers | Date: 2010-02-03 03:21:13 |
| Subject: Re: BUG #5308: How to disable Case sensitivity on naming identifiers |
| Previous: | From: Joe Conway | Date: 2010-02-03 02:25:27 |
| Subject: Re: BUG #5304: psql using conninfo fails in connecting to
the server |