Re: drop table if exists

From: Philip Hallstrom <philip(at)adhesivemedia(dot)com>
To: Jason Watkins <jason_watkins(at)pobox(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: drop table if exists
Date: 2001-07-03 22:38:54
Message-ID: 20010703153823.P89242-100000@oddjob.adhesivemedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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
>

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2001-07-03 22:52:52 Re: simple function crashes my postmaster
Previous Message Alex Pilosov 2001-07-03 22:31:51 Re: count(*)