Config file for psql
Hi,
A little while ago there was someone asking for tools to make it easier
to connect to multiple servers. It occured to me that it might be
useful to have a config file the way ssh does it:
Host production
ServerName db1
DBName main
Username blah
Password blah
UseSSL yes
Host test
ServerName db2
ServerPort 5434
DBName main
Username blah
Password blah
Host *
Username default
So when you type "psql test" it fills in the server name, port,
database, username and password for you. For hosts not listed, it gives
a default username "default". It's really just a variation on the
.netrc file.
Thoughts?
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
Show quoted text
Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
tool for doing 5% of the work and then sitting around waiting for someone
else to do the other 95% so you can sue them.
Martijn van Oosterhout wrote:
A little while ago there was someone asking for tools to make it
easier to connect to multiple servers. It occured to me that it might
be useful to have a config file the way ssh does it:
That looks suspiciously like the service facility that we already have.
--
Peter Eisentraut
http://developer.postgresql.org/~petere/
On Sat, Feb 18, 2006 at 07:52:22PM +0100, Martijn van Oosterhout wrote:
A little while ago there was someone asking for tools to make it easier
to connect to multiple servers. It occured to me that it might be
useful to have a config file the way ssh does it:
Something like pg_service.conf? Hardly anybody ever mentions it
even though the libpq documentation refers to it; I wonder how many
people even know it exists.
http://www.postgresql.org/docs/8.1/interactive/libpq.html#LIBPQ-CONNECT
http://www.postgresql.org/docs/8.1/interactive/libpq-envars.html
--
Michael Fuhr
Michael Fuhr wrote:
On Sat, Feb 18, 2006 at 07:52:22PM +0100, Martijn van Oosterhout wrote:
A little while ago there was someone asking for tools to make it easier
to connect to multiple servers. It occured to me that it might be
useful to have a config file the way ssh does it:Something like pg_service.conf? Hardly anybody ever mentions it
even though the libpq documentation refers to it; I wonder how many
people even know it exists.http://www.postgresql.org/docs/8.1/interactive/libpq.html#LIBPQ-CONNECT
http://www.postgresql.org/docs/8.1/interactive/libpq-envars.html
This needs a LOT more prominence. We probably need to refer to these
things on the manual pages for each of the libpq clients we have.
Haven't we learned that lesson from .pgpass ? The number of people who
read the libpq docs is probably vanishingly small.
cheers
andrew
Andrew Dunstan <andrew@dunslane.net> writes:
This needs a LOT more prominence. We probably need to refer to these
things on the manual pages for each of the libpq clients we have.
Haven't we learned that lesson from .pgpass ? The number of people who
read the libpq docs is probably vanishingly small.
Perhaps we should make a concerted effort to split the libpq docs into a
section "for programmers" vs one "for users", the latter part covering
the libpq behavior that is interesting to users of a libpq-based app.
.pgpass, pg_service, the environment vars, SSL behavior, maybe some
other things belong in the "for users" part.
I think only the environment-vars page is currently linked from the
client-apps reference pages, but if we did this we could link to the
entire for-users section and be done with it.
regards, tom lane
On Sat, Feb 18, 2006 at 12:19:39PM -0700, Michael Fuhr wrote:
On Sat, Feb 18, 2006 at 07:52:22PM +0100, Martijn van Oosterhout wrote:
A little while ago there was someone asking for tools to make it easier
to connect to multiple servers. It occured to me that it might be
useful to have a config file the way ssh does it:Something like pg_service.conf? Hardly anybody ever mentions it
even though the libpq documentation refers to it; I wonder how many
people even know it exists.
I'd say not many? If you search the mail archives for "pg_service.conf"
in the last two years, there's only 15 matches and even then it's only
ever mentioned on -hackers or -patches.
For example, nobody brought it up that last thread about connecting to
multiple servers, even though it would have been the perfect solution.
I certainly never heard of it and I've been using postgres and been on
-general for several years.
Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
Show quoted text
Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
tool for doing 5% of the work and then sitting around waiting for someone
else to do the other 95% so you can sue them.
On Sat, Feb 18, 2006 at 02:49:08PM -0500, Tom Lane wrote:
Perhaps we should make a concerted effort to split the libpq docs into a
section "for programmers" vs one "for users", the latter part covering
the libpq behavior that is interesting to users of a libpq-based app.
.pgpass, pg_service, the environment vars, SSL behavior, maybe some
other things belong in the "for users" part.
+1. Is there a docs TODO?
--
Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461
Jim C. Nasby wrote:
On Sat, Feb 18, 2006 at 02:49:08PM -0500, Tom Lane wrote:
Perhaps we should make a concerted effort to split the libpq docs into a
section "for programmers" vs one "for users", the latter part covering
the libpq behavior that is interesting to users of a libpq-based app.
.pgpass, pg_service, the environment vars, SSL behavior, maybe some
other things belong in the "for users" part.+1. Is there a docs TODO?
Added to TODO:
* Split out libpq pgpass and environment documentation sections
to make it easier for non-developers to find
Looking at the existing manual, how do we do this? Do we make separate
libpq-programming and a libpq-runtime sections?
--
Bruce Momjian http://candle.pha.pa.us
SRA OSS, Inc. http://www.sraoss.com
+ If your life is a hard drive, Christ can be your backup. +