X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 19E0A9FB2C2 for ; Wed, 16 Aug 2006 16:10:50 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 91349-06 for ; Wed, 16 Aug 2006 19:10:46 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from main2.mycybernet.net (main2.mycybernet.net [209.222.63.140]) by postgresql.org (Postfix) with ESMTP id D74CE9FB2F2 for ; Wed, 16 Aug 2006 16:10:45 -0300 (ADT) Received: from 227-54-222-209.mycybernet.net ([209.222.54.227] helo=phlogiston.dydns.org) by main2.mycybernet.net with esmtp (Exim 4.62) (envelope-from ) id 1GDQzB-0007Ga-SC for pgsql-sql@postgresql.org; Wed, 16 Aug 2006 15:23:29 -0400 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id 8C8F84051; Wed, 16 Aug 2006 15:10:39 -0400 (EDT) Date: Wed, 16 Aug 2006 15:10:39 -0400 From: Andrew Sullivan To: pgsql-sql@postgresql.org Subject: Re: DB creation script questions Message-ID: <20060816191039.GF25228@phlogiston.dyndns.org> References: <4f4c2a010608161144v61381db8m2d9148915673757d@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4f4c2a010608161144v61381db8m2d9148915673757d@mail.gmail.com> User-Agent: Mutt/1.5.9i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200608/126 X-Sequence-Number: 26084 On Wed, Aug 16, 2006 at 02:44:58PM -0400, Jon Horsman wrote: > I have previously used MySQL and was able to accomplish this very > simply using IF NOT EXISTS for the table and database creation but > this doesn't seem to be available for postgres and i'm looking for a > more robust solution anyways. Well, you could query the SQL-standard Information Schema. Alternatively, you can query the system tables like pg_class. But if you want the more standard one, use the tables under schema information_schema. That's the reason there's a standard. A -- Andrew Sullivan | ajs@crankycanuck.ca This work was visionary and imaginative, and goes to show that visionary and imaginative work need not end up well. --Dennis Ritchie