Search Postgresql Archives

Alter Columns with Triggers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux