PG-221: Use alternate of GetUserID function in error hook.

This commit is contained in:
Ibrar Ahmed
2021-08-31 14:55:53 +00:00
parent aee45ebe52
commit 3d3ece2f99
3 changed files with 23 additions and 18 deletions

View File

@@ -1489,11 +1489,12 @@ pgss_store(uint64 queryid,
return;
Assert(query != NULL);
GetUserIdAndSecContext((unsigned int *)&userid, &con);
if (userid == 0)
return;
if (kind == PGSS_ERROR)
GetUserIdAndSecContext((unsigned int *)&userid, &con);
else
userid = GetUserId();
comments = extract_query_comments(query);
comments = extract_query_comments(query);
/* Safety check... */
if (!IsSystemInitialized() || !pgss_qbuf[pgss->current_wbucket])