Re: Create Table Problem

From: Volkan YAZICI <yazicivo(at)ttmail(dot)com>
To: "Shavonne Marietta Wijesinghe" <shavonne(dot)marietta(at)studioform(dot)it>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Create Table Problem
Date: 2008-06-13 12:31:15
Message-ID: 87y759wm7g.fsf@alamut.mobiliz.com.tr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Shavonne Marietta Wijesinghe" <shavonne(dot)marietta(at)studioform(dot)it> writes:
> IF (table not found) THEN
> CREATE TABLE distributors (
> did integer,
> name varchar(40),
> UNIQUE(name)
> );
> END IF

Assuming you're in a procedure (above code snippet looks to be executed
within a PL/pgsql procedure):

IF EXISTS (SELECT 1
FROM information_schema.tables
WHERE table_schema = 'public' AND
table_name = 'distributors)
THEN ...
END IF;

Regards.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Andreas 2008-06-13 16:02:45 How to manage category-ids as array-fields ?
Previous Message Shavonne Marietta Wijesinghe 2008-06-13 12:05:05 Create Table Problem