From jkanter@virginia.edu Wed May 26 15:10:59 2004 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 83204D1B345 for ; Wed, 26 May 2004 12:10:59 -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 06097-05 for ; Wed, 26 May 2004 12:10:39 -0300 (ADT) Received: from unix.mail.Virginia.EDU (unix.mail.Virginia.EDU [128.143.2.28]) by svr1.postgresql.org (Postfix) with ESMTP id DCE88D1B459 for ; Wed, 26 May 2004 12:10:37 -0300 (ADT) Received: from smtp.mail.Virginia.EDU (smtp.mail.Virginia.EDU [128.143.22.52]) by unix.mail.Virginia.EDU (Postfix) with ESMTP id B0164AB0C for ; Wed, 26 May 2004 11:10:36 -0400 (EDT) Received: from virginia.edu (d-137-133-128.bootp.Virginia.EDU [137.54.133.128]) by smtp.mail.Virginia.EDU (Postfix) with ESMTP id 263D62102E for ; Wed, 26 May 2004 11:10:36 -0400 (EDT) Message-ID: <40B4B438.2060900@virginia.edu> Date: Wed, 26 May 2004 11:14:00 -0400 From: Jodi Kanter User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Postgres Admin List Subject: table check Content-Type: multipart/alternative; boundary="------------070004070708010606050409" X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.7 tagged_above=0.0 required=5.0 tests=HTML_70_80, HTML_MESSAGE, HTML_TITLE_EMPTY X-Spam-Level: X-Archive-Number: 200405/277 X-Sequence-Number: 13593 This is a multi-part message in MIME format. --------------070004070708010606050409 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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 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? Thank you, Jodi -- /_______________________________ //Jodi L Kanter BioInformatics Database Administrator University of Virginia (434) 924-2846 jkanter@virginia.edu / / / / / --------------070004070708010606050409 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit 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 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?
Thank you,
Jodi
--
________________________________

_______________________________
Jodi L Kanter
BioInformatics Database Administrator
University of Virginia
(434) 924-2846
jkanter@virginia.edu


 

 

 

--------------070004070708010606050409-- From bruno@wolff.to Wed May 26 15:46:54 2004 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.