Re: Checking for table existence

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Julester <cubalibr(at)optonline(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Checking for table existence
Date: 2001-09-17 14:57:54
Message-ID: Pine.BSF.4.21.0109170757050.57838-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, 14 Sep 2001, Julester wrote:

> Hi everyone. In my old SQL Server days, I used a command such as "IF
> exists(select name from sys_objects where name = 'xyztable')" to check if a
> table existed before creating it with a standard CREATE command. I looked
> in the PostgreSQL documentation, but for the life of me, I can't find an
> equivalent. I can view if the table exists by doing a select against the
> meta-data tables, but what about the IF statement ? Any help would be
> greatly appreciated. Thanks.

AFAIK, not really directly in SQL, but you can wrap such things in
functions in plpgsql/pltcl/etc...

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2001-09-17 15:27:31 Re: I could do with some guidance
Previous Message Haller Christoph 2001-09-17 14:15:32 Re: Number the lines