pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_service.conf and client support
4+ messages / 4 participants
[nested] [flat]

* pg_service.conf and client support
@ 2020-06-14 05:03  Niels Jespersen <NJN@dst.dk>
  0 siblings, 3 replies; 4+ messages in thread

From: Niels Jespersen @ 2020-06-14 05:03 UTC (permalink / raw)
  To: pgsql-general

Hello all

I just found out about the pg service file. https://www.postgresql.org/docs/current/libpq-pgservice.html

I don't know why it took me so long finding this. I have been looking for ways to abstract physical details of data location away for clients (much like Oracle's tnsnames).

Want to move a cluster to a new host. Sure, move it, edit pg_service.conf and clients will not know the difference.

It works great for at least psql and psycopg2.

But I cannot find anything on pg_service.conf and the Postgres ODBC driver and Npgsql for .Net

I know pg_service.conf support is implemented through libpq and support for rivers not using libpq is not a given thing.

But I think the need for the abstraction of connection details is a general one.

Can anyone shed som light on the ubiquitousness of support for pg_service.conf?

Are there any other mechanisms with broader support, that can be used instead of pg_service.conf (if support is scarce beyond what builds on libpq)?

Thank you.

Regards Niels Jespersen

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pg_service.conf and client support
@ 2020-06-14 05:26  David G. Johnston <david.g.johnston@gmail.com>
  parent: Niels Jespersen <NJN@dst.dk>
  2 siblings, 0 replies; 4+ messages in thread

From: David G. Johnston @ 2020-06-14 05:26 UTC (permalink / raw)
  To: Niels Jespersen <NJN@dst.dk>; +Cc: pgsql-general

On Saturday, June 13, 2020, Niels Jespersen <NJN@dst.dk> wrote:

> Can anyone shed som light on the ubiquitousness of support for
> pg_service.conf?
>
AFAIK same non-support for JDBC and Node.js

> Are there any other mechanisms with broader support, that can be used
> instead of pg_service.conf (if support is scarce beyond what builds on
> libpq)?
>
> Not that I am aware, though programmatically accessed libraries are
somewhat able to be adapted using custom wrappers so that the pg_service
file contents can be leveraged.

David J.

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pg_service.conf and client support
@ 2020-06-14 16:01  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Niels Jespersen <NJN@dst.dk>
  2 siblings, 0 replies; 4+ messages in thread

From: Adrian Klaver @ 2020-06-14 16:01 UTC (permalink / raw)
  To: Niels Jespersen <NJN@dst.dk>; pgsql-general

On 6/13/20 10:03 PM, Niels Jespersen wrote:
> Hello all
> 
> I just found out about the pg service file. 
> https://www.postgresql.org/docs/current/libpq-pgservice.html
> 
> I don’t know why it took me so long finding this. I have been looking 
> for ways to abstract physical details of data location away for clients 
> (much like Oracle’s tnsnames).
> 
> Want to move a cluster to a new host. Sure, move it, edit 
> pg_service.conf and clients will not know the difference.
> 
> It works great for at least psql and psycopg2.
> 
> But I cannot find anything on pg_service.conf and the Postgres ODBC 
> driver and Npgsql for .Net
> 
> I know pg_service.conf support is implemented through libpq and support 
> for rivers not using libpq is not a given thing.
> 
> But I think the need for the abstraction of connection details is a 
> general one.
> 
> Can anyone shed som light on the ubiquitousness of support for 
> pg_service.conf?
> 
> Are there any other mechanisms with broader support, that can be used 
> instead of pg_service.conf (if support is scarce beyond what builds on 
> libpq)?

Only thing I know of is something like 
pgbouncer(http://www.pgbouncer.org/) where you keep a constant 
connection setting for the pooler and then change the settings for the 
database(s) it connects to.

> 
> Thank you.
> 
> Regards Niels Jespersen
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pg_service.conf and client support
@ 2020-06-15 09:23  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: Niels Jespersen <NJN@dst.dk>
  2 siblings, 0 replies; 4+ messages in thread

From: Laurenz Albe @ 2020-06-15 09:23 UTC (permalink / raw)
  To: Niels Jespersen <NJN@dst.dk>; pgsql-general

On Sun, 2020-06-14 at 05:03 +0000, Niels Jespersen wrote:
> I just found out about the pg service file. https://www.postgresql.org/docs/current/libpq-pgservice.html
> 
> I don’t know why it took me so long finding this. I have been looking for ways to abstract physical details of data location away for clients (much like Oracle’s tnsnames).
> 
> Want to move a cluster to a new host. Sure, move it, edit pg_service.conf and clients will not know the difference.
> 
> It works great for at least psql and psycopg2.
> 
> But I cannot find anything on pg_service.conf and the Postgres ODBC driver and Npgsql for .Net
> 
> I know pg_service.conf support is implemented through libpq and support for rivers not using libpq is not a given thing.
> 
> But I think the need for the abstraction of connection details is a general one.
> 
> Can anyone shed som light on the ubiquitousness of support for pg_service.conf?

You got it right: pg_service.conf is only used by libpq, so all clients that
use libpq automatically support it.  Other clients don't support it.

For your examples that means:
- The PostgreSQL ODBC server can use pg_service.conf
- NpgSQL cannot use the file.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com






^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2020-06-15 09:23 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-06-14 05:03 pg_service.conf and client support Niels Jespersen <NJN@dst.dk>
2020-06-14 05:26 ` David G. Johnston <david.g.johnston@gmail.com>
2020-06-14 16:01 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-15 09:23 ` Laurenz Albe <laurenz.albe@cybertec.at>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox