diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 6e7dc86dfe..964c588e3c 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -268,6 +268,7 @@ typedef struct opclasscacheent static HTAB *OpClassCache = NULL; + /* non-export function prototypes */ static void RelationDestroyRelation(Relation relation, bool remember_tupdesc); @@ -5525,16 +5526,15 @@ RelationGetExclusionInfo(Relation indexRelation, * Get the publication information for the given relation. * * Traverse all the publications which the relation is in to get the - * publication actions. + * publication actions and validate the row filter expressions for such + * publications if any. We consider the row filter expression as invalid if it + * references any column which is not part of REPLICA IDENTITY. * - * If validate_rowfilter is true and the publication actions include UPDATE or - * DELETE, then validate that if all columns referenced in the row filter - * expression are part of REPLICA IDENTITY. If any invalid column found, return - * the invalid column number immediately. + * To avoid fetching the publication information, we cache the publication + * actions and row filter validation information. * - * If validate_rowfilter is false or all columns are valid, set the - * relation->rd_rfcol_valid to true, cache the collected publication actions in - * relation->rd_pubactions, and return InvalidAttrNumber. + * Returns the column number of an invalid column referenced in a row filter + * expression if any, InvalidAttrNumber otherwise. */ AttrNumber GetRelationPublicationInfo(Relation relation, bool validate_rowfilter)