Re: How do I drop something that might not exist?

From: "Leif B(dot) Kristensen" <leif(at)solumslekt(dot)org>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: How do I drop something that might not exist?
Date: 2009-03-19 14:40:12
Message-ID: 200903191540.12533.leif@solumslekt.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message David Saracini 2009-03-19 15:19:57 Re: How do I drop something that might not exist?
Previous Message kulmacet101 2009-03-19 14:29:11 Re: Check if table exists