Re: Conditional Statement - Mailing list pgsql-general

From missive@frontiernet.net (Lee Harr)
Subject Re: Conditional Statement
Date
Msg-id slrna885lg.55.missive@whave.frontiernet.net
Whole thread Raw
In response to Conditional Statement  (Samik Raychauhduri <samik@cae.wisc.edu>)
List 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.


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Changes to NOW() in 7.2?
Next
From: "PG"
Date:
Subject: Slow in VB Grid with PG