aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/opclasscmds.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2019-05-05 13:10:07 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2019-05-05 13:10:07 -0400
commit9691aa72e2a7fb146ac759e1f8a8b04962128cc0 (patch)
tree1a21f675aad53fbb043617a6bcff28c312758013 /src/backend/commands/opclasscmds.c
parent62148c3520b562e518f17134b22120bab0cb113b (diff)
downloadpostgresql-9691aa72e2a7fb146ac759e1f8a8b04962128cc0.tar.gz
postgresql-9691aa72e2a7fb146ac759e1f8a8b04962128cc0.zip
Fix style violations in syscache lookups.
Project style is to check the success of SearchSysCacheN and friends by applying HeapTupleIsValid to the result. A tiny minority of calls creatively did it differently. Bring them into line with the rest. This is just cosmetic, since HeapTupleIsValid is indeed just a null check at the moment ... but that may not be true forever, and in any case it puts a mental burden on readers who may wonder why these call sites are not like the rest. Back-patch to v11 just to keep the branches in sync. (The bulk of these errors seem to have originated in v11 or v12, though a few are old.) Per searching to see if anyplace else had made the same error repaired in 62148c352.
Diffstat (limited to 'src/backend/commands/opclasscmds.c')
-rw-r--r--src/backend/commands/opclasscmds.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/commands/opclasscmds.c b/src/backend/commands/opclasscmds.c
index 5d73848a8b9..b8c7b9657f7 100644
--- a/src/backend/commands/opclasscmds.c
+++ b/src/backend/commands/opclasscmds.c
@@ -1071,7 +1071,7 @@ assignOperTypes(OpFamilyMember *member, Oid amoid, Oid typeoid)
/* Fetch the operator definition */
optup = SearchSysCache1(OPEROID, ObjectIdGetDatum(member->object));
- if (optup == NULL)
+ if (!HeapTupleIsValid(optup))
elog(ERROR, "cache lookup failed for operator %u", member->object);
opform = (Form_pg_operator) GETSTRUCT(optup);
@@ -1137,7 +1137,7 @@ assignProcTypes(OpFamilyMember *member, Oid amoid, Oid typeoid)
/* Fetch the procedure definition */
proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(member->object));
- if (proctup == NULL)
+ if (!HeapTupleIsValid(proctup))
elog(ERROR, "cache lookup failed for function %u", member->object);
procform = (Form_pg_proc) GETSTRUCT(proctup);