pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Database system identifier from SQL
4+ messages / 2 participants
[nested] [flat]

* Database system identifier from SQL
@ 2007-07-10 14:24 Peter Eisentraut <peter_e@gmx.net>
  2007-07-10 15:23 ` Re: Database system identifier from SQL Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Peter Eisentraut @ 2007-07-10 14:24 UTC (permalink / raw)
  To: pgsql-sql

Is there a way to query the database system identifier that pg_controldata 
outputs from SQL?

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



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

* Re: Database system identifier from SQL
  2007-07-10 14:24 Database system identifier from SQL Peter Eisentraut <peter_e@gmx.net>
@ 2007-07-10 15:23 ` Tom Lane <tgl@sss.pgh.pa.us>
  2007-07-10 18:06   ` Re: Database system identifier from SQL Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2007-07-10 15:23 UTC (permalink / raw)
  To: Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-sql

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?

			regards, tom lane



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

* Re: Database system identifier from SQL
  2007-07-10 14:24 Database system identifier from SQL Peter Eisentraut <peter_e@gmx.net>
  2007-07-10 15:23 ` Re: Database system identifier from SQL Tom Lane <tgl@sss.pgh.pa.us>
@ 2007-07-10 18:06   ` Peter Eisentraut <peter_e@gmx.net>
  2007-07-10 18:15     ` Re: Database system identifier from SQL Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Peter Eisentraut @ 2007-07-10 18:06 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-sql

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/



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

* Re: Database system identifier from SQL
  2007-07-10 14:24 Database system identifier from SQL Peter Eisentraut <peter_e@gmx.net>
  2007-07-10 15:23 ` Re: Database system identifier from SQL Tom Lane <tgl@sss.pgh.pa.us>
  2007-07-10 18:06   ` Re: Database system identifier from SQL Peter Eisentraut <peter_e@gmx.net>
@ 2007-07-10 18:15     ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2007-07-10 18:15 UTC (permalink / raw)
  To: Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-sql

Peter Eisentraut <peter_e@gmx.net> writes:
> 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.

Hmm.  Seems a bit of an odd case, but on the other hand there might be
applications for it in connection with management of backups and
WAL-shipping and so forth.  I have no objection to adding a function.

			regards, tom lane



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


end of thread, other threads:[~2007-07-10 18:15 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-07-10 14:24 Database system identifier from SQL Peter Eisentraut <peter_e@gmx.net>
2007-07-10 15:23 ` Tom Lane <tgl@sss.pgh.pa.us>
2007-07-10 18:06   ` Peter Eisentraut <peter_e@gmx.net>
2007-07-10 18:15     ` Tom Lane <tgl@sss.pgh.pa.us>

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