Re: BUG #5688: ALTER TABLE ALTER col TYPE newtype fails if col is named in an UPDATE OF col trigger

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #5688: ALTER TABLE ALTER col TYPE newtype fails if col is named in an UPDATE OF col trigger
Дата
Msg-id 3930.1285978040@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #5688: ALTER TABLE ALTER col TYPE newtype fails if col is named in an UPDATE OF col trigger  ("Daniel Grace" <dgrace@wingsnw.com>)
Список pgsql-bugs
"Daniel Grace" <dgrace@wingsnw.com> writes:
> Description:        ALTER TABLE ALTER col TYPE newtype fails if col is named
> in an UPDATE OF col trigger

Hmm, definitely a missed case (and defensive programming saves the day
again).

There are actually two cases as of 9.0 where a trigger could depend on a
column:
    * UPDATE OF said column, as in your example
    * column is used in trigger's WHEN clause

In the first case we could just allow the ALTER to proceed, but in the
second case we'd have to adjust the WHEN expression for the column's new
type, which is something there's not code for now.  And it doesn't look
like we can easily tell which case applies.  I think what we'll have to
do here is just throw a FEATURE_NOT_SUPPORTED error, and maybe add a
TODO item to come back to improve that someday.  (Since you can just
drop the trigger and re-add it after the ALTER, a nicer fix doesn't seem
like a high priority IMO.)

Thanks for the report!  It's too late for 9.0.1 but we'll do something
about this for 9.0.2.

            regards, tom lane

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

Предыдущее
От: "Daniel Grace"
Дата:
Сообщение: BUG #5688: ALTER TABLE ALTER col TYPE newtype fails if col is named in an UPDATE OF col trigger
Следующее
От: Andrea Peri
Дата:
Сообщение: Postgres 9.0 crash on win7