|
8 | 8 | * |
9 | 9 | * |
10 | 10 | * IDENTIFICATION |
11 | | - * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.119 2004/07/11 23:13:53 tgl Exp $ |
| 11 | + * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.120 2004/07/17 17:28:29 tgl Exp $ |
12 | 12 | * |
13 | 13 | *------------------------------------------------------------------------- |
14 | 14 | */ |
@@ -1706,6 +1706,20 @@ update_ri_trigger_args(Oid relid, |
1706 | 1706 |
|
1707 | 1707 | CatalogUpdateIndexes(tgrel,tuple); |
1708 | 1708 |
|
| 1709 | +/* |
| 1710 | + * Invalidate trigger's relation's relcache entry so that other |
| 1711 | + * backends (and this one too!) are sent SI message to make them |
| 1712 | + * rebuild relcache entries. (Ideally this should happen |
| 1713 | + * automatically...) |
| 1714 | + * |
| 1715 | + * We can skip this for triggers on relid itself, since that |
| 1716 | + * relcache flush will happen anyway due to the table or column |
| 1717 | + * rename. We just need to catch the far ends of RI relationships. |
| 1718 | + */ |
| 1719 | +pg_trigger= (Form_pg_trigger)GETSTRUCT(tuple); |
| 1720 | +if (pg_trigger->tgrelid!=relid) |
| 1721 | +CacheInvalidateRelcacheByRelid(pg_trigger->tgrelid); |
| 1722 | + |
1709 | 1723 | /* free up our scratch memory */ |
1710 | 1724 | pfree(newtgargs); |
1711 | 1725 | heap_freetuple(tuple); |
|