PGSERVICEFILE as a connection string parameter

Started by Michael Paquieralmost 9 years ago7 messages
#1Michael Paquier
michael.paquier@gmail.com

Hi all,

I bumped into a case where it would have been rather useful to specify
a service file path in a connection string with a service name. In my
case, I have finished by setting up PGSERVICEFILE, but now like
PGPASSFILE I think that being able to define the service file
available as well as a connection parameter would be useful as well.

I am not planning to work on that immediately (there is one day left
for the last CF of PG10!), but I was wondering if people would be
interested in something like that.
So, opinions?
--
Michael

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#2Andres Freund
andres@anarazel.de
In reply to: Michael Paquier (#1)
Re: PGSERVICEFILE as a connection string parameter

Hi,

On 2017-02-27 14:43:49 +0900, Michael Paquier wrote:

I bumped into a case where it would have been rather useful to specify
a service file path in a connection string with a service name. In my
case, I have finished by setting up PGSERVICEFILE, but now like
PGPASSFILE I think that being able to define the service file
available as well as a connection parameter would be useful as well.

I am not planning to work on that immediately (there is one day left
for the last CF of PG10!), but I was wondering if people would be
interested in something like that.

Hm - I'm not sure that's a good idea. service files are a libpq feature,
but connection strings are a bit more universal than just libpq...

Regards,

Andres

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3David Fetter
david@fetter.org
In reply to: Andres Freund (#2)
Re: PGSERVICEFILE as a connection string parameter

On Sun, Feb 26, 2017 at 10:03:40PM -0800, Andres Freund wrote:

Hi,

On 2017-02-27 14:43:49 +0900, Michael Paquier wrote:

I bumped into a case where it would have been rather useful to
specify a service file path in a connection string with a service
name. In my case, I have finished by setting up PGSERVICEFILE, but
now like PGPASSFILE I think that being able to define the service
file available as well as a connection parameter would be useful
as well.

I am not planning to work on that immediately (there is one day
left for the last CF of PG10!), but I was wondering if people
would be interested in something like that.

Hm - I'm not sure that's a good idea. service files are a libpq
feature, but connection strings are a bit more universal than just
libpq...

You bring up a salient point. What say we make pg_services a little
more universal? I'm guessing that the Java port wouldn't be too
complicated. It's already well defined.

Best,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Magnus Hagander
magnus@hagander.net
In reply to: Andres Freund (#2)
Re: PGSERVICEFILE as a connection string parameter

On Mon, Feb 27, 2017 at 7:03 AM, Andres Freund <andres@anarazel.de> wrote:

Hi,

On 2017-02-27 14:43:49 +0900, Michael Paquier wrote:

I bumped into a case where it would have been rather useful to specify
a service file path in a connection string with a service name. In my
case, I have finished by setting up PGSERVICEFILE, but now like
PGPASSFILE I think that being able to define the service file
available as well as a connection parameter would be useful as well.

I am not planning to work on that immediately (there is one day left
for the last CF of PG10!), but I was wondering if people would be
interested in something like that.

Hm - I'm not sure that's a good idea. service files are a libpq feature,
but connection strings are a bit more universal than just libpq...

That same argument applies to PGPASSFILE, does it not?

Properly implementing PGSERVICEFILE is more complicated though -- as it
requires LDAP support to go there the whole way for example. But it might
not hurt to encourage other drivers (such as jdbc) to support at least the
basic format of pgpass.

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

#5Andres Freund
andres@anarazel.de
In reply to: Magnus Hagander (#4)
Re: [HACKERS] PGSERVICEFILE as a connection string parameter

On 2017-02-27 16:23:46 +0100, Magnus Hagander wrote:

On Mon, Feb 27, 2017 at 7:03 AM, Andres Freund <andres@anarazel.de> wrote:

On 2017-02-27 14:43:49 +0900, Michael Paquier wrote:

I bumped into a case where it would have been rather useful to specify
a service file path in a connection string with a service name. In my
case, I have finished by setting up PGSERVICEFILE, but now like
PGPASSFILE I think that being able to define the service file
available as well as a connection parameter would be useful as well.

I am not planning to work on that immediately (there is one day left
for the last CF of PG10!), but I was wondering if people would be
interested in something like that.

Hm - I'm not sure that's a good idea. service files are a libpq feature,
but connection strings are a bit more universal than just libpq...

That same argument applies to PGPASSFILE, does it not?

It does. I'm not really convinced it's a good idea to have that as a
full blown parameter, but as you say:

Properly implementing PGSERVICEFILE is more complicated though -- as it
requires LDAP support to go there the whole way for example.

But it might not hurt to encourage other drivers (such as jdbc) to
support at least the basic format of pgpass.

Probably makes sense to bring in some of the external driver authors
(jdbc, npgsql CCed).

Greetings,

Andres Freund

--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc

#6Dave Cramer
pg@fastcrypt.com
In reply to: Andres Freund (#5)
Re: [HACKERS] PGSERVICEFILE as a connection string parameter

+Vladimir

On 27 February 2017 at 11:36, Andres Freund <andres@anarazel.de> wrote:

On 2017-02-27 16:23:46 +0100, Magnus Hagander wrote:

On Mon, Feb 27, 2017 at 7:03 AM, Andres Freund <andres@anarazel.de>

wrote:

On 2017-02-27 14:43:49 +0900, Michael Paquier wrote:

I bumped into a case where it would have been rather useful to

specify

a service file path in a connection string with a service name. In my
case, I have finished by setting up PGSERVICEFILE, but now like
PGPASSFILE I think that being able to define the service file
available as well as a connection parameter would be useful as well.

I am not planning to work on that immediately (there is one day left
for the last CF of PG10!), but I was wondering if people would be
interested in something like that.

Hm - I'm not sure that's a good idea. service files are a libpq

feature,

but connection strings are a bit more universal than just libpq...

That same argument applies to PGPASSFILE, does it not?

It does. I'm not really convinced it's a good idea to have that as a
full blown parameter, but as you say:

Properly implementing PGSERVICEFILE is more complicated though -- as it
requires LDAP support to go there the whole way for example.

But it might not hurt to encourage other drivers (such as jdbc) to
support at least the basic format of pgpass.

Probably makes sense to bring in some of the external driver authors
(jdbc, npgsql CCed).

Currently PGPASS is in the users home directory Many JDBC applications are

in much larger apps such as tomcat, etal
this concept is a bit foreign to JDBC. That being said I don't think it's
difficult to implement. Just somewhat harder to specify
for us. psql is rather limited being a command line app which is *usually*
evoked directly from the command line.

Dave Cramer

davec@postgresintl.com
www.postgresintl.com

#7Vladimir Sitnikov
sitnikov.vladimir@gmail.com
In reply to: Dave Cramer (#6)
Re: [JDBC] [HACKERS] PGSERVICEFILE as a connection string parameter

David>I'm guessing that the Java port wouldn't be too
complicated. It's already well defined.

Is encoding defined somewhere for the "service file"?
I don't like the idea of using "a default" very much.

Vladimir