pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Philip Hallstrom <philip@adhesivemedia.com>
To: Jason Watkins <jason_watkins@pobox.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: drop table if exists
Date: Tue, 3 Jul 2001 15:38:54 -0700 (PDT)
Message-ID: <20010703153823.P89242-100000@oddjob.adhesivemedia.com> (raw)
In-Reply-To: <018b01c10406$8bcbaae0$426f2a40@boondocksaint>

Just drop the table using "DROP TABLE mytable;" and ignore the error...
I'm sure there are fancy ways of doing it by accessing system tables, but
the above works for me.

On Tue, 3 Jul 2001, Jason Watkins wrote:

> How can I duplicate the behavior of:
>
> DROP TABLE IF EXISTS mytable;
>
> CREATE TABLE mytable (
> blah,
> blah
> );
>
> INSERT INTO mytable
> (blah)
> VALUES
> (blah);
>
> in other words, so that I have a single sql file that restores the database
> to a known state.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://www.postgresql.org/search.mpl
>




view thread (4+ messages)  latest in thread

Message-ID: <20010703153823.P89242-100000@oddjob.adhesivemedia.com>
Permalink:  ../20010703153823.P89242-100000@oddjob.adhesivemedia.com/
Also on:    postgresql.org/message-id/20010703153823.P89242-100000@oddjob.adhesivemedia.com

 · 

reply

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: philip@adhesivemedia.com, jason_watkins@pobox.com
  Subject: Re: drop table if exists
  In-Reply-To: <20010703153823.P89242-100000@oddjob.adhesivemedia.com>

* 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