Re: connect by service name in psql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Stuart" <smcg2297(at)frii(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: connect by service name in psql
Date: 2007-08-25 03:01:12
Message-ID: 26413.1188010872@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Stuart" <smcg2297(at)frii(dot)com> writes:
>> I can't find an option in psql to connect to a database
>> by "service" name? Should there be one?

In 8.3 libpq will have code that interprets what's usually the database
name parameter as a "conninfo" string if there's an "=" in it, which
means you can get at the service name as well as a lot of other arcane
options even if the calling application (such as psql) doesn't know they
exist.

For instance,

$ psql "service = foo"
psql: ERROR: service file "/home/postgres/version83/etc/pg_service.conf" not found

(I didn't actually bother to make a service file, but you can see that
the code knew what it was supposed to do.)

I suppose this is more awkward than something like "psql -S foo", but
we're unlikely to want to keep putting connection-related switches into
psql and all the other client apps ...

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stuart 2007-08-25 03:27:02 Re: connect by service name in psql
Previous Message Tatsuo Ishii 2007-08-25 02:18:11 Re: lc_collate issue