Re: [SQL] Database system identifier from SQL

2007-07-10 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes:
> Tom Lane wrote:
>> Peter Eisentraut <[EMAIL PROTECTED]> 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

---(end of broadcast)---
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate


Re: [SQL] Database system identifier from SQL

2007-07-10 Thread Peter Eisentraut
Tom Lane wrote:
> Peter Eisentraut <[EMAIL PROTECTED]> 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/

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [SQL] Database system identifier from SQL

2007-07-10 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> 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

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


[SQL] Database system identifier from SQL

2007-07-10 Thread Peter Eisentraut
Is there a way to query the database system identifier that pg_controldata 
outputs from SQL?

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

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq