Re: drop table if exists - Mailing list pgsql-sql

From Philip Hallstrom
Subject Re: drop table if exists
Date
Msg-id 20010703153823.P89242-100000@oddjob.adhesivemedia.com
Whole thread Raw
In response to drop table if exists  ("Jason Watkins" <jason_watkins@pobox.com>)
List 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
>



pgsql-sql by date:

Previous
From: Alex Pilosov
Date:
Subject: Re: count(*)
Next
From: Tom Lane
Date:
Subject: Re: simple function crashes my postmaster