mirror of
https://github.com/postgres/postgres.git
synced 2025-11-18 02:02:55 +03:00
Add missing Datum conversions
Add various missing conversions from and to Datum. The previous code mostly relied on implicit conversions or its own explicit casts instead of using the correct DatumGet*() or *GetDatum() functions. We think these omissions are harmless. Some actual bugs that were discovered during this process have been committed separately (80c758a2e1,fd2ab03fea). Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/flat/8246d7ff-f4b7-4363-913e-827dadfeb145%40eisentraut.org
This commit is contained in:
@@ -1924,7 +1924,7 @@ AddRoleMems(Oid currentUserId, const char *rolename, Oid roleid,
|
||||
*/
|
||||
if ((popt->specified & GRANT_ROLE_SPECIFIED_INHERIT) != 0)
|
||||
new_record[Anum_pg_auth_members_inherit_option - 1] =
|
||||
popt->inherit;
|
||||
BoolGetDatum(popt->inherit);
|
||||
else
|
||||
{
|
||||
HeapTuple mrtup;
|
||||
@@ -1935,14 +1935,14 @@ AddRoleMems(Oid currentUserId, const char *rolename, Oid roleid,
|
||||
elog(ERROR, "cache lookup failed for role %u", memberid);
|
||||
mrform = (Form_pg_authid) GETSTRUCT(mrtup);
|
||||
new_record[Anum_pg_auth_members_inherit_option - 1] =
|
||||
mrform->rolinherit;
|
||||
BoolGetDatum(mrform->rolinherit);
|
||||
ReleaseSysCache(mrtup);
|
||||
}
|
||||
|
||||
/* get an OID for the new row and insert it */
|
||||
objectId = GetNewOidWithIndex(pg_authmem_rel, AuthMemOidIndexId,
|
||||
Anum_pg_auth_members_oid);
|
||||
new_record[Anum_pg_auth_members_oid - 1] = objectId;
|
||||
new_record[Anum_pg_auth_members_oid - 1] = ObjectIdGetDatum(objectId);
|
||||
tuple = heap_form_tuple(pg_authmem_dsc,
|
||||
new_record, new_record_nulls);
|
||||
CatalogTupleInsert(pg_authmem_rel, tuple);
|
||||
|
||||
Reference in New Issue
Block a user