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

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

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


  • From: "Leif B. 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: Thu, 19 Mar 2009 15:40:12 +0100
  • Message-id: <200903191540.12533.leif@solumslekt.org> <text/plain>

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/



Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group