conditionally executing migration code

From: "Michael P(dot) Soulier" <michael_soulier(at)mitel(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: conditionally executing migration code
Date: 2008-06-05 18:15:58
Message-ID: 48482D5E.9050201@mitel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm using some simple migration code to execute individual fragments of
SQL code based on the version of the schema. Is there a way to perform
an ALTER TABLE conditionally?

Example:

I want to add column foo to table bar, but only if column foo does not
exist already.

I'm trying to avoid such situations, but it's not always easy.

Thanks,
Mike
--
Michael P. Soulier <michael_soulier(at)mitel(dot)com>, 613-592-2122 x2522
"Any intelligent fool can make things bigger and more complex... It
takes a touch of genius - and a lot of courage to move in the opposite
direction." --Albert Einstein

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tim Tassonis 2008-06-05 18:36:00 Re: Temporary Tables and Web Application
Previous Message Francisco Reyes 2008-06-05 18:10:33 Bizgrez dead?