Commit edda32ee authored by Peter Eisentraut's avatar Peter Eisentraut

Fix compiler warning

Rewrite get_attgenerated() to avoid compiler warning if the compiler
does not recognize that elog(ERROR) does not return.
Reported-by: default avatarDavid Rowley <david.rowley@2ndquadrant.com>
parent 82150a05
...@@ -836,22 +836,19 @@ char ...@@ -836,22 +836,19 @@ char
get_attgenerated(Oid relid, AttrNumber attnum) get_attgenerated(Oid relid, AttrNumber attnum)
{ {
HeapTuple tp; HeapTuple tp;
Form_pg_attribute att_tup;
char result;
tp = SearchSysCache2(ATTNUM, tp = SearchSysCache2(ATTNUM,
ObjectIdGetDatum(relid), ObjectIdGetDatum(relid),
Int16GetDatum(attnum)); Int16GetDatum(attnum));
if (HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
{
Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
char result;
result = att_tup->attgenerated;
ReleaseSysCache(tp);
return result;
}
else
elog(ERROR, "cache lookup failed for attribute %d of relation %u", elog(ERROR, "cache lookup failed for attribute %d of relation %u",
attnum, relid); attnum, relid);
att_tup = (Form_pg_attribute) GETSTRUCT(tp);
result = att_tup->attgenerated;
ReleaseSysCache(tp);
return result;
} }
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment