From: Andrew Sullivan <ajs@crankycanuck.ca>
To: pgsql-sql@postgresql.org
Subject: Re: DB creation script questions
Date: Wed, 16 Aug 2006 15:10:39 -0400
Message-ID: <20060816191039.GF25228@phlogiston.dyndns.org> (raw)
In-Reply-To: <4f4c2a010608161144v61381db8m2d9148915673757d@mail.gmail.com>
References: <4f4c2a010608161144v61381db8m2d9148915673757d@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: ajs@crankycanuck.ca
Subject: Re: DB creation script questions
In-Reply-To: <20060816191039.GF25228@phlogiston.dyndns.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox