X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id A44D09F9B01 for ; Mon, 22 May 2006 14:28:55 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 74446-10 for ; Mon, 22 May 2006 14:28:49 -0300 (ADT) X-Greylist: delayed 00:59:59.198986 by SQLgrey- Received: from mmp3.nems.noaa.gov (mmp3.nems.noaa.gov [140.90.121.158]) by postgresql.org (Postfix) with ESMTP id 003899F9D99 for ; Mon, 22 May 2006 14:28:48 -0300 (ADT) Received: from [198.206.42.50] (hopper.wiln.noaa.gov [198.206.42.50]) by mmp3.nems.noaa.gov (iPlanet Messaging Server 5.2 HotFix 2.01 (built Aug 26 2004)) with ESMTPSA id <0IZO00H4LDRURH@mmp3.nems.noaa.gov> for pgsql-sql@postgresql.org; Mon, 22 May 2006 12:28:47 -0400 (EDT) Date: Mon, 22 May 2006 12:28:41 -0400 From: Mark Fenbers Subject: Does PG have a database To: pgsql-sql@postgresql.org Message-id: <4471E6B9.9080002@noaa.gov> Organization: DOC/NOAA/NWS/OHRFC MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT User-Agent: Thunderbird 1.5.0.2 (Windows/20060308) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/167 X-Sequence-Number: 25198 I have working PostgreSQL databases on 3 of my ~30 Linux boxes. I want my software to be able to determine which of my 30 boxes have functional databases on them. Since Pg is part of the baseline distro, merely checking for the existence of an executable doesn't solve my problem. I tried looping through my list of hosts and running the command: psql -h $host --list but this fails on a box with a database with the same error code as on a box that doesn't have a database, if my PGUSER isn't set and my login ID is not the username of the database. The PGUSER setting might differ for each host, so specifying this in the software is not practical. Bottom line: What trick can I use to determine whether a box has a living, breathing Pg database if I don't know the DB owner? Mark