mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
Remove get_attidentity()
All existing uses can get this information more easily from the relation descriptor, so the detour through the syscache is not necessary. Reviewed-by: Michael Paquier <michael@paquier.xyz>
This commit is contained in:
32
src/backend/utils/cache/lsyscache.c
vendored
32
src/backend/utils/cache/lsyscache.c
vendored
@ -821,38 +821,6 @@ get_attnum(Oid relid, const char *attname)
|
||||
return InvalidAttrNumber;
|
||||
}
|
||||
|
||||
/*
|
||||
* get_attidentity
|
||||
*
|
||||
* Given the relation id and the attribute name,
|
||||
* return the "attidentity" field from the attribute relation.
|
||||
*
|
||||
* Returns '\0' if not found.
|
||||
*
|
||||
* Since no identity is represented by '\0', this can also be used as a
|
||||
* Boolean test.
|
||||
*/
|
||||
char
|
||||
get_attidentity(Oid relid, AttrNumber attnum)
|
||||
{
|
||||
HeapTuple tp;
|
||||
|
||||
tp = SearchSysCache2(ATTNUM,
|
||||
ObjectIdGetDatum(relid),
|
||||
Int16GetDatum(attnum));
|
||||
if (HeapTupleIsValid(tp))
|
||||
{
|
||||
Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
|
||||
char result;
|
||||
|
||||
result = att_tup->attidentity;
|
||||
ReleaseSysCache(tp);
|
||||
return result;
|
||||
}
|
||||
else
|
||||
return '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* get_atttype
|
||||
*
|
||||
|
Reference in New Issue
Block a user