From 9915fe8a1a8a80c54054c1e9ad94510c850b0fa9 Mon Sep 17 00:00:00 2001 From: Jeff Davis Date: Sat, 9 Apr 2022 10:57:26 -0700 Subject: [PATCH] PG15: Handle different ways to get publication actions. Account for PG commit 52e4f0cd47. --- src/backend/columnar/columnar_tableam.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/backend/columnar/columnar_tableam.c b/src/backend/columnar/columnar_tableam.c index 9967a265e..a16210fb7 100644 --- a/src/backend/columnar/columnar_tableam.c +++ b/src/backend/columnar/columnar_tableam.c @@ -2292,18 +2292,30 @@ detoast_values(TupleDesc tupleDesc, Datum *orig_values, bool *isnull) static void ColumnarCheckLogicalReplication(Relation rel) { + bool pubActionInsert = false; + if (!is_publishable_relation(rel)) { return; } +#if PG_VERSION_NUM >= PG_VERSION_15 + { + PublicationDesc pubdesc; + + RelationBuildPublicationDesc(rel, &pubdesc); + pubActionInsert = pubdesc.pubactions.pubinsert; + } +#else if (rel->rd_pubactions == NULL) { GetRelationPublicationActions(rel); Assert(rel->rd_pubactions != NULL); } + pubActionInsert = rel->rd_pubactions->pubinsert; +#endif - if (rel->rd_pubactions->pubinsert) + if (pubActionInsert) { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg(