mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-21 21:21:22 +08:00
PG16: Replace pg_class_ownercheck() with object_ownercheck
PG16 replaces pg_foo_ownercheck() functions with a common object_ownercheck() function. Added a new compat function for pg_class_ownercheck() function affected by this change and replaced all its callers. postgres/postgres@afbfc029
This commit is contained in:
parent
22ea5771ad
commit
a9505b4095
@ -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 */
|
||||
|
@ -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));
|
||||
|
@ -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")));
|
||||
|
Loading…
x
Reference in New Issue
Block a user