X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1F4A0D1B16F for ; Wed, 26 May 2004 12:46:54 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 29469-06 for ; Wed, 26 May 2004 12:46:33 -0300 (ADT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id A120FD1B19C for ; Wed, 26 May 2004 12:46:30 -0300 (ADT) Received: (qmail 2541 invoked by uid 500); 26 May 2004 15:51:48 -0000 Date: Wed, 26 May 2004 10:51:48 -0500 From: Bruno Wolff III To: Jodi Kanter Cc: Postgres Admin List Subject: Re: table check Message-ID: <20040526155148.GA2484@wolff.to> Mail-Followup-To: Jodi Kanter , Postgres Admin List References: <40B4B438.2060900@virginia.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <40B4B438.2060900@virginia.edu> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/282 X-Sequence-Number: 13598 On Wed, May 26, 2004 at 11:14:00 -0400, Jodi Kanter wrote: > We are working on checking to see whether a database has been created > from a Perl/Pg interface. Is there an easy way to count tables such You should be checking the return code when creating each object and the commit for the transaction. If these indeicate success then the objects were created. > that if the count comes back at zero the script knows that the database > has not yet been created? > We tried simply using \d but cannot get that to work. I would assume > there is some system table that must list the tables when there are some?? > thoughts? \d is a psql command that isn't available in the perl interfaces. You can either query the informatation schema or use the -E option on psql to see what queries to use on the version of Postgres you are running to retrieve that information.