Re: Problems renaming referencing column
От | Tom Lane |
---|---|
Тема | Re: Problems renaming referencing column |
Дата | |
Msg-id | 15516.1090085451@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Problems renaming referencing column ("Alexander M. Pravking" <fduch@antar.bryansk.ru>) |
Список | pgsql-bugs |
"Alexander M. Pravking" <fduch@antar.bryansk.ru> writes: > In 7.4.3, if I rename a column which references another table, > constraint trigger fails on update or delete from main table. The following patch (against 7.4.*) appears to fix this problem. regards, tom lane Index: tablecmds.c =================================================================== RCS file: /cvsroot/pgsql-server/src/backend/commands/tablecmds.c,v retrieving revision 1.91 diff -c -r1.91 tablecmds.c *** tablecmds.c 13 Oct 2003 22:47:15 -0000 1.91 --- tablecmds.c 17 Jul 2004 17:16:36 -0000 *************** *** 1534,1539 **** --- 1534,1553 ---- CatalogUpdateIndexes(tgrel, tuple); + /* + * Invalidate trigger's relation's relcache entry so that other + * backends (and this one too!) are sent SI message to make them + * rebuild relcache entries. (Ideally this should happen + * automatically...) + * + * We can skip this for triggers on relid itself, since that + * relcache flush will happen anyway due to the table or column + * rename. We just need to catch the far ends of RI relationships. + */ + pg_trigger = (Form_pg_trigger) GETSTRUCT(tuple); + if (pg_trigger->tgrelid != relid) + CacheInvalidateRelcache(pg_trigger->tgrelid); + /* free up our scratch memory */ pfree(newtgargs); heap_freetuple(tuple);
В списке pgsql-bugs по дате отправления: