Re: EXISTS - Mailing list pgsql-sql

From Tom Lane
Subject Re: EXISTS
Date
Msg-id 23925.1223746321@sss.pgh.pa.us
Whole thread Raw
In response to EXISTS  (Denis Woodbury <denis@woodmic.net>)
Responses Re: EXISTS  (Denis Woodbury <denis@woodmic.net>)
List pgsql-sql
Denis Woodbury <denis@woodmic.net> writes:
> I would like to know if this this type of statement can be used in
> Postgresql

> IF NOT EXISTS (SELECT 1 FROM Table WHERE col1 = 'mystring' )
> BEGIN
> ...
> END

I suspect you are trying to type that directly into SQL.
You need to be using plpgsql in order to use procedural
logic (ie, if/then).
        regards, tom lane


pgsql-sql by date:

Previous
From: "Leif B. Kristensen"
Date:
Subject: Re: EXISTS
Next
From: "Christopher Maier"
Date:
Subject: Order of trigger execution: AFTER DELETE ON EACH ROW doesn't appear to be working properly