pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter_e@gmx.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: Database system identifier from SQL
Date: Tue, 10 Jul 2007 20:06:10 +0200
Message-ID: <200707102006.11643.peter_e@gmx.net> (raw)
In-Reply-To: <20025.1184080999@sss.pgh.pa.us>
References: <200707101624.47885.peter_e@gmx.net>
	<20025.1184080999@sss.pgh.pa.us>

Tom Lane wrote:
> Peter Eisentraut <peter_e@gmx.net> writes:
> > Is there a way to query the database system identifier that
> > pg_controldata outputs from SQL?
>
> Don't think so.  Do you have a use-case for providing a function to
> return that?

I'd like to find out whether two connections are really to the same 
server.

This is in the context of an installation routine for a database 
application which pulls the connection parameters for several databases 
from a configuration file and creates various things there.  It should, 
however, only create roles once if the connection parameters point to 
the same server (if the user only expects a small installation, say).

A workaround is to compare inet_server_addr() and inet_server_port(), 
but that is not 100% safe because it doesn't cover Unix-domain sockets 
using different paths.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/



view thread (4+ messages)  latest in thread

Message-ID: <200707102006.11643.peter_e@gmx.net>
Permalink:  ../200707102006.11643.peter_e@gmx.net/
Also on:    postgresql.org/message-id/200707102006.11643.peter_e@gmx.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: peter_e@gmx.net, tgl@sss.pgh.pa.us
  Subject: Re: Database system identifier from SQL
  In-Reply-To: <200707102006.11643.peter_e@gmx.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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