IF EXISTS

From: stevethames <steve(at)softlife(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: IF EXISTS
Date: 2006-09-20 21:18:37
Message-ID: 6416894.post@talk.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


I have a script that sets up my databases which I run whenever I change any
of the functions. It has a number of things it does that are unnecessary
and cause errors. I create some types, sequences, etc. The error messages
are irritating. I'd like to do something like this:

IF NOT EXISTS (SELECT relname FROM pg_class WHERE relname='seqid')
CREATE SEQUENCE SeqID;

This works in other SQL languages like SQLServer and MySQL. Is there
anything like this in PostgreSQL?

--
View this message in context: http://www.nabble.com/IF-EXISTS-tf2308139.html#a6416894
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Terry Lee Tucker 2006-09-20 21:29:06 Re: Question Regarding a Temporary Table
Previous Message Jeff Davis 2006-09-20 21:09:40 Re: Question Regarding a Temporary Table