From 9691aa72e2a7fb146ac759e1f8a8b04962128cc0 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 5 May 2019 13:10:07 -0400 Subject: 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. --- src/backend/commands/operatorcmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/backend/commands/operatorcmds.c') diff --git a/src/backend/commands/operatorcmds.c b/src/backend/commands/operatorcmds.c index 7b98e4b910c..17f54410a00 100644 --- a/src/backend/commands/operatorcmds.c +++ b/src/backend/commands/operatorcmds.c @@ -407,7 +407,7 @@ AlterOperator(AlterOperatorStmt *stmt) oprId = LookupOperWithArgs(stmt->opername, false); catalog = table_open(OperatorRelationId, RowExclusiveLock); tup = SearchSysCacheCopy1(OPEROID, ObjectIdGetDatum(oprId)); - if (tup == NULL) + if (!HeapTupleIsValid(tup)) elog(ERROR, "cache lookup failed for operator %u", oprId); oprForm = (Form_pg_operator) GETSTRUCT(tup); -- cgit v1.2.3