Alter Columns with Triggers

Поиск
Список
Период
Сортировка
От Adrian Parker
Тема Alter Columns with Triggers
Дата
Msg-id CAFTut86VctEKEy7uEopQ91gOthhi=tLqDRoniVUBCE6De9KJGQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: Alter Columns with Triggers  (Craig Ringer <craig@postnewspapers.com.au>)
Re: Alter Columns with Triggers  (Sim Zacks <sim@compulab.co.il>)
Список 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

В списке pgsql-general по дате отправления:

Предыдущее
От: Tim Uckun
Дата:
Сообщение: Re: Unexpected results with joins on dates
Следующее
От: Jonathan Barber
Дата:
Сообщение: Re: Slow queries (high duration) and their log entries appearing out-of-order