Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit edda32e

Browse files
committed
Fix compiler warning
Rewrite get_attgenerated() to avoid compiler warning if the compiler does not recognize that elog(ERROR) does not return. Reported-by: David Rowley <david.rowley@2ndquadrant.com>
1 parent 82150a0 commit edda32e

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/backend/utils/cache/lsyscache.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -836,22 +836,19 @@ char
836836
get_attgenerated(Oid relid, AttrNumber attnum)
837837
{
838838
HeapTuple tp;
839+
Form_pg_attribute att_tup;
840+
char result;
839841

840842
tp = SearchSysCache2(ATTNUM,
841843
ObjectIdGetDatum(relid),
842844
Int16GetDatum(attnum));
843-
if (HeapTupleIsValid(tp))
844-
{
845-
Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
846-
char result;
847-
848-
result = att_tup->attgenerated;
849-
ReleaseSysCache(tp);
850-
return result;
851-
}
852-
else
845+
if (!HeapTupleIsValid(tp))
853846
elog(ERROR, "cache lookup failed for attribute %d of relation %u",
854847
attnum, relid);
848+
att_tup = (Form_pg_attribute) GETSTRUCT(tp);
849+
result = att_tup->attgenerated;
850+
ReleaseSysCache(tp);
851+
return result;
855852
}
856853

857854
/*

0 commit comments

Comments
 (0)