cache-inval-ft-options-1.patch

text/x-diff

Filename: cache-inval-ft-options-1.patch
Type: text/x-diff
Part: 0
Message: Re: postgres_fdw : altering foreign table not invalidating prepare statement execution plan.

Patch

Format: unified
File+
src/backend/commands/tablecmds.c 7 0
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 9e9082d..6a4e1d6 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -11642,6 +11642,13 @@ ATExecGenericOptions(Relation rel, List *options)
 	simple_heap_update(ftrel, &tuple->t_self, tuple);
 	CatalogUpdateIndexes(ftrel, tuple);
 
+	/*
+	 * Invalidate the relcache for the table, so that after this commit
+	 * all sessions will refresh any cached plans that are based on older
+	 * values of the options.
+	 */
+	CacheInvalidateRelcache(rel);
+
 	InvokeObjectPostAlterHook(ForeignTableRelationId,
 							  RelationGetRelid(rel), 0);