Re: Re: Test for existence of Table - Mailing list pgsql-general

From Gregory Wood
Subject Re: Re: Test for existence of Table
Date
Msg-id 001f01c07743$94da42e0$7889ffcc@comstock.com
Whole thread Raw
In response to RE: Re: Test for existence of Table  ("Craig L. Ching" <cching@mqsoftware.com>)
List pgsql-general
> >> DROP TABLE employees
> >Error: ERROR:  Relation 'employees' does not exist
> >
> >And execution halts.... which is I believe why he wanted to check for the
> >existence before trying to DROP. I'd love to know if this exists as
well...
> >would come in very handy during development time.
>
> Execution does not halt, it continues and creates the table.  I rely on
this
> functionality, so I know it works.  Good luck!

Well, that is a quote from the database tool I use, and execution does
indeed halt. I can only assume you are using psql, which someone confirmed
that that does work. Also, if you wrap your queries in an explicit
transaction (I don't like to leave anything to Auto-Commit), it will also
fail:

NOTICE:  current transaction is aborted, queries ignored until end of
transaction block

What would be nice is if there were a way to only DROP a table if it exists.
But I would consider this to be rather low priority.

Greg


pgsql-general by date:

Previous
From: "Craig L. Ching"
Date:
Subject: RE: Re: Test for existence of Table
Next
From: Scott Teglasi
Date:
Subject: Using Postgres with Access 2000