Re: Conditional Statement

From: missive(at)frontiernet(dot)net (Lee Harr)
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Conditional Statement
Date: 2002-03-05 00:54:29
Message-ID: slrna885lg.55.missive@whave.frontiernet.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> Hello,
> 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.
> Thanks and regards.
> -Samik
>

Is there reason the table must not exist before you drop it?

When I write SQL scripts (to be fed in to psql) I just go ahead
and drop the table (whether it is really there or not) and if it
does not exist, there is a warning, but the script keeps running.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lee Harr 2002-03-05 00:57:50 Re: Migration problem - serial fields
Previous Message Tom Lane 2002-03-04 23:22:06 Re: Changes to NOW() in 7.2?