Re: psql commandline conninfo

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql commandline conninfo
Date: 2006-12-12 22:44:07
Message-ID: 457F30B7.2040707@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>
>> I have been working on providing psql with the ability to accept a libpq
>> conninfo string, so that the following now works for me:
>> psql "conn:service=sname user=uname"
>>
>
> Perhaps this should be implemented in libpq, not at the psql level?
> Otherwise you're going to have to do it over for each client program.
>
>

Just as well I haven't spent much time on it, eh?
>> 2. If this is ok, what should the prefix be? is "conn:" ok?
>>
>
> I'd prefer to dispense with the conn:, so that this looks somehow
> designed in rather than bolted on after the fact.
>

well, I thought this made it look slightly URLish, a bit like a jbdc
URL. But OK. no big deal.

> I'm tempted to suggest that if the "dbname" includes "=" it should be
> considered a conninfo string; perhaps also after checking keyword
> validity.
>

Now I look at fe-connect.c more closely, I'm tempted just to try parsing
the dbname param as a conninfo string, and if it doesn't work fall back
on a plain dbname. I could greatly reduce the chance of following the
failure path by just looking for an = but I think anything more is
likely to be redundant.

>
>> 3. Should we append settings from other switches to the conninfo (e.g.
>> -U or -h), or should we just ignore them? If we ignore them should we
>> warn about that if they are present?
>>
>
> Do we complain about duplicate keywords in conninfo now? I think not,
> so appending the other switches would have the result of overriding what
> is in conninfo, which is probably reasonable. (Actually, if you
> implement this in libpq, there's probably no need to form the appended
> string explicitly --- just process the other options of PQsetdbLogin()
> after the conninfo.)
>
>

OK. I think this just falls out.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-12-12 22:52:29 Re: psql commandline conninfo
Previous Message Bruce Momjian 2006-12-12 22:30:57 Re: EXPLAIN ANALYZE

Browse pgsql-patches by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-12-12 22:52:29 Re: psql commandline conninfo
Previous Message Tom Lane 2006-12-12 21:52:15 Re: psql commandline conninfo