Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id BE2C49FB8DD for ; Tue, 10 Jul 2007 15:06:26 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 00502-02-3 for ; Tue, 10 Jul 2007 15:06:25 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by postgresql.org (Postfix) with SMTP id 862449FBB57 for ; Tue, 10 Jul 2007 15:06:15 -0300 (ADT) Received: (qmail invoked by alias); 10 Jul 2007 18:06:13 -0000 Received: from xdsl-87-79-230-47.netcologne.de (EHLO colt.pezone.net) [87.79.230.47] by mail.gmx.net (mp057) with SMTP; 10 Jul 2007 20:06:13 +0200 X-Authenticated: #495269 X-Provags-ID: V01U2FsdGVkX18IhUoOOM8Iga2+8M7gVVQo5zvXVutmSANA0bVW4z fx7GilCM/BmzL3 From: Peter Eisentraut To: Tom Lane Subject: Re: Database system identifier from SQL Date: Tue, 10 Jul 2007 20:06:10 +0200 User-Agent: KMail/1.9.5 Cc: pgsql-sql@postgresql.org References: <200707101624.47885.peter_e@gmx.net> <20025.1184080999@sss.pgh.pa.us> In-Reply-To: <20025.1184080999@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200707102006.11643.peter_e@gmx.net> X-Y-GMX-Trusted: 0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/49 X-Sequence-Number: 28784 Tom Lane wrote: > Peter Eisentraut 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/