Re: Conditional Statement

From: "Marshall Spight" <marshall(at)meetstheeye(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Conditional Statement
Date: 2002-03-06 06:20:09
Message-ID: a64cep$24ht$1@jupiter.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Samik Raychauhduri" <samik(at)cae(dot)wisc(dot)edu> wrote in message news:3C82CA4C(dot)6030205(at)cae(dot)wisc(dot)edu(dot)(dot)(dot)
> I am trying to write a piece of SQL code, which will first check if a
> table exist, drop it and then recreate it. I didn't see any 'IF' syntax
> in pgsql. Is there any other alternative? I tried to use 'case'
> structure, but didn't succeed.

The way you do that is to say:

drop table foo
create table foo ...

That's all you need. Nothing fancy. The 'drop table' will print a message
if the table didn't exist already, but it doesn't matter.

Marshall

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Oliver Elphick 2002-03-06 06:34:58 Re: help with getting index scan
Previous Message Thomas T. Thai 2002-03-06 06:08:44 Re: help with getting index scan