PG-210: Add new column toplevel.

pull/138/head
Ibrar Ahmed 2021-11-16 11:23:59 +00:00
parent 5f6177daa3
commit 680c7fda42
2 changed files with 6 additions and 3 deletions

View File

@ -1499,8 +1499,11 @@ pgss_store(uint64 queryid,
key.ip = pg_get_client_addr(); key.ip = pg_get_client_addr();
key.planid = planid; key.planid = planid;
key.appid = appid; key.appid = appid;
#if PG_VERSION_NUM < 140000
key.toplevel = 1;
#else
key.toplevel = (nested_level == 0); key.toplevel = (nested_level == 0);
#endif
pgss_hash = pgsm_get_hash(); pgss_hash = pgsm_get_hash();
LWLockAcquire(pgss->lock, LW_SHARED); LWLockAcquire(pgss->lock, LW_SHARED);
@ -1695,7 +1698,7 @@ pg_stat_monitor_internal(FunctionCallInfo fcinfo,
uint64 planid = entry->key.planid; uint64 planid = entry->key.planid;
unsigned char *buf = pgss_qbuf[bucketid]; unsigned char *buf = pgss_qbuf[bucketid];
#if PG_VERSION_NUM < 140000 #if PG_VERSION_NUM < 140000
bool toplevel = true; bool toplevel = 1;
bool is_allowed_role = is_member_of_role(GetUserId(), DEFAULT_ROLE_READ_ALL_STATS); bool is_allowed_role = is_member_of_role(GetUserId(), DEFAULT_ROLE_READ_ALL_STATS);
#else #else
bool is_allowed_role = is_member_of_role(GetUserId(), ROLE_PG_READ_ALL_STATS); bool is_allowed_role = is_member_of_role(GetUserId(), ROLE_PG_READ_ALL_STATS);

View File

@ -203,7 +203,7 @@ typedef struct pgssHashKey
uint64 ip; /* client ip address */ uint64 ip; /* client ip address */
uint64 planid; /* plan identifier */ uint64 planid; /* plan identifier */
uint64 appid; /* hash of application name */ uint64 appid; /* hash of application name */
bool toplevel; /* query executed at top level */ uint64 toplevel; /* query executed at top level */
} pgssHashKey; } pgssHashKey;
typedef struct QueryInfo typedef struct QueryInfo