Re: Test for existence of Table

From: "Gregory Wood" <gregw(at)com-stock(dot)com>
To: "PostgreSQL-General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Test for existence of Table
Date: 2001-01-05 03:11:31
Message-ID: 002501c076c5$35194fa0$7889ffcc@comstock.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Greg

> Yeah,
>
> DROP TABLE employees
> CREATE TABLE employees
>
> ;-)
>
> Craig
>
> -----Original Message-----
> From: Soma Interesting [mailto:dfunct(at)telus(dot)net]
> Sent: Thursday, January 04, 2001 1:40 PM
> To: pgsql-general(at)postgresql(dot)org
> Subject: [GENERAL] Test for existence of Table
>
>
> Can I test for an existing table before issuing the "CREATE TABLE"
command?
>
> IF EXISTS employees{
> DROP TABLE employees
> }
> CREATE TABLE employees
>
> Can you provide an example of this. I couldn't find this in the manual or
> Bruce's book - did I not look hard enough ? :)
>
>
> - - - - - - -
> - - - -
> WARNING: Some experts believe that use of any keyboard may cause
> serious injury. Consult Users Guide.
>
> dfunct(at)telus(dot)net
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Blake Crosby 2001-01-05 03:12:47 Re: Time Zone Query
Previous Message Luis Fernando Fabara M. 2001-01-05 02:36:05 Cobol TO SQL To PostgreSQL