Re: psql commandline conninfo - Mailing list pgsql-hackers

From Tom Lane
Subject Re: psql commandline conninfo
Date
Msg-id 25310.1165960335@sss.pgh.pa.us
Whole thread Raw
In response to psql commandline conninfo  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: psql commandline conninfo
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.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.

> 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.

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

> 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.)
        regards, tom lane


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: psql commandline conninfo
Next
From: Bruce Momjian
Date:
Subject: Re: EXPLAIN ANALYZE