Re: How do I drop something that might not exist? - Mailing list pgsql-novice

From Leif B. Kristensen
Subject Re: How do I drop something that might not exist?
Date
Msg-id 200903191540.12533.leif@solumslekt.org
Whole thread Raw
In response to How do I drop something that might not exist?  ("Rob Richardson" <Rob.Richardson@rad-con.com>)
List pgsql-novice
On Thursday 19. March 2009, Rob Richardson wrote:
>I tried using an if statement combined with the EXISTS() function:
>
>if exists(select 1 from this_sequence_does_not_exist) then
>    drop sequence this_sequence_does_not_exist;
>end if;

I don't know if it applies to your particular problem, but the standard
SQL if-then-else construct is:

CASE WHEN foo THEN bar ELSE baz;

HTH,
--
Leif Biberg Kristensen | Registered Linux User #338009
Me And My Database: http://solumslekt.org/blog/

pgsql-novice by date:

Previous
From: kulmacet101@kulmacet.com
Date:
Subject: Re: Check if table exists
Next
From: David Saracini
Date:
Subject: Re: How do I drop something that might not exist?