Skip site navigation (1) Skip section navigation (2)

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 (view raw, whole thread or download thread mbox)
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

pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group