From: | Adrian Parker <adrian(dot)l(dot)parker(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Alter Columns with Triggers |
Date: | 2011-07-12 01:23:27 |
Message-ID: | CAFTut86VctEKEy7uEopQ91gOthhi=tLqDRoniVUBCE6De9KJGQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello. I'm quite new to Postgres. I've just been assigned the task of
changing 300+ Double Precision columns, spread out over 30+ tables, to
be of type Numeric(100, 3). Many of the columns have one or more
triggers/functions on them.
The alterations will run from a python program acting as a database
migrator, and access to the database will be disabled while the
migrator runs. I can progmatically query for all columns of type
double precision, and run Alter statements against them, but how do I
deal with Triggers/Functions? It seems I need to remove both the
trigger and function, and re-add them after the table is altered. Some
functions refer to others though.
None of the columns to be changed are primary or foreign keys.
Ideally I'd like a query that allows me to alter all the column types
which I need to alter despite the triggers/functions in place, but I
suppose this is not possible.
Is there a quick and easy fix? Currently I'm copying/pasting the
drop/create statements from pgadmin (its very slow and error prone)
and putting them in my python source.
Adrian
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2011-07-12 01:24:55 | Re: Accidentally truncated pg_type |
Previous Message | Chris Travers | 2011-07-12 01:18:08 | Re: Interesting article, Facebook woes using MySQL |