Conditional ALTER TABLE

From: Dale Seaburg <kg5lt(at)verizon(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Conditional ALTER TABLE
Date: 2009-05-26 22:59:06
Message-ID: E6A569AE-7056-4CD9-9CF3-C85FDC1AA2AC@verizon.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Is there a way to make a conditional ALTER TABLE command?

If I want to drop a column only if that table's column exists, what
would be the correct syntax. I have tried several IF EXISTS, but I
get an error at "IF". I would like to use the Query tool in pgAdmin
III, if possible. But, if push comes to shove, I'll resort to psql.

As an alternative, how best to tell SQL (Query tool) to continue
processing a script even if an "error" (like no column exists) is
encountered.

Thanks,

Dale

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2009-05-26 23:03:47 Re: Conditional ALTER TABLE
Previous Message Ron Arts 2009-05-26 19:58:08 Re: I don't understand this explain output