From 2a990abd79acea4717cc8f982a28f35b6b347ddb Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Thu, 20 Jul 2023 15:18:25 +0900 Subject: Add missing ObjectIdGetDatum() in syscache lookup calls for Oids Based on how postgres.h foes the Oid <-> Datum conversion, there is no existing bugs but let's be consistent. 17 spots have been noticed as incorrectly passing down Oids rather than Datums. Aleksander got one, Zhang two and I the rest. Author: Michael Paquier, Aleksander Alekseev, Zhang Mingli Discussion: https://postgr.es/m/ZLUhqsqQN1MOaxdw@paquier.xyz --- src/backend/utils/adt/acl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/backend/utils/adt/acl.c') diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c index 883e09393a4..27eabb80abc 100644 --- a/src/backend/utils/adt/acl.c +++ b/src/backend/utils/adt/acl.c @@ -5334,13 +5334,13 @@ get_rolespec_tuple(const RoleSpec *role) case ROLESPEC_CURRENT_ROLE: case ROLESPEC_CURRENT_USER: - tuple = SearchSysCache1(AUTHOID, GetUserId()); + tuple = SearchSysCache1(AUTHOID, ObjectIdGetDatum(GetUserId())); if (!HeapTupleIsValid(tuple)) elog(ERROR, "cache lookup failed for role %u", GetUserId()); break; case ROLESPEC_SESSION_USER: - tuple = SearchSysCache1(AUTHOID, GetSessionUserId()); + tuple = SearchSysCache1(AUTHOID, ObjectIdGetDatum(GetSessionUserId())); if (!HeapTupleIsValid(tuple)) elog(ERROR, "cache lookup failed for role %u", GetSessionUserId()); break; -- cgit v1.2.3