diff --git a/src/compat/compat.h b/src/compat/compat.h index a05be8ba7..a9c57a7ae 100644 --- a/src/compat/compat.h +++ b/src/compat/compat.h @@ -880,6 +880,23 @@ object_aclcheck(Oid classid, Oid objectid, Oid roleid, AclMode mode) } return ACLCHECK_NOT_OWNER; } + +/* + * PG16 replaces pg_foo_ownercheck() functions with a common object_ownercheck() function + * https://github.com/postgres/postgres/commit/afbfc029 + */ +static inline bool +object_ownercheck(Oid classid, Oid objectid, Oid roleid) +{ + switch (classid) + { + case RelationRelationId: + return pg_class_ownercheck(objectid, roleid); + default: + Assert(false); + } + return false; +} #endif #endif /* TIMESCALEDB_COMPAT_H */ diff --git a/tsl/src/continuous_aggs/refresh.c b/tsl/src/continuous_aggs/refresh.c index 98c2af6fd..a6298c747 100644 --- a/tsl/src/continuous_aggs/refresh.c +++ b/tsl/src/continuous_aggs/refresh.c @@ -778,7 +778,7 @@ continuous_agg_refresh_internal(const ContinuousAgg *cagg, ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), (errmsg("could not set search_path")))); /* Like regular materialized views, require owner to refresh. */ - if (!pg_class_ownercheck(cagg->relid, GetUserId())) + if (!object_ownercheck(RelationRelationId, cagg->relid, GetUserId())) aclcheck_error(ACLCHECK_NOT_OWNER, get_relkind_objtype(get_rel_relkind(cagg->relid)), get_rel_name(cagg->relid)); diff --git a/tsl/src/reorder.c b/tsl/src/reorder.c index 16b0e58a4..806e98a03 100644 --- a/tsl/src/reorder.c +++ b/tsl/src/reorder.c @@ -416,7 +416,7 @@ reorder_chunk(Oid chunk_id, Oid index_id, bool verbose, Oid wait_id, Oid destina /* Our check gives better error messages, but keep the original one too. */ ts_hypertable_permissions_check(ht->main_table_relid, GetUserId()); - if (!pg_class_ownercheck(ht->main_table_relid, GetUserId())) + if (!object_ownercheck(RelationRelationId, ht->main_table_relid, GetUserId())) { Oid main_table_relid = ht->main_table_relid; @@ -565,7 +565,7 @@ reorder_rel(Oid tableOid, Oid indexOid, bool verbose, Oid wait_id, Oid destinati * that the relation still is what we think it is. */ /* Check that the user still owns the relation */ - if (!pg_class_ownercheck(tableOid, GetUserId())) + if (!object_ownercheck(RelationRelationId, tableOid, GetUserId())) { relation_close(OldHeap, ExclusiveLock); ereport(WARNING, (errcode(ERRCODE_WARNING), errmsg("ownership changed during reorder")));