mirror of
https://github.com/postgres/postgres.git
synced 2025-04-25 21:42:33 +03:00
Remove get_atttypmod()
This has been unused since 2004. get_atttypetypmodcoll() is often a better alternative. Reviewed-by: Michael Paquier <michael@paquier.xyz>
This commit is contained in:
parent
e6f5d1accd
commit
c903bb7b1c
29
src/backend/utils/cache/lsyscache.c
vendored
29
src/backend/utils/cache/lsyscache.c
vendored
@ -880,40 +880,13 @@ get_atttype(Oid relid, AttrNumber attnum)
|
|||||||
return InvalidOid;
|
return InvalidOid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* get_atttypmod
|
|
||||||
*
|
|
||||||
* Given the relation id and the attribute number,
|
|
||||||
* return the "atttypmod" field from the attribute relation.
|
|
||||||
*/
|
|
||||||
int32
|
|
||||||
get_atttypmod(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);
|
|
||||||
int32 result;
|
|
||||||
|
|
||||||
result = att_tup->atttypmod;
|
|
||||||
ReleaseSysCache(tp);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get_atttypetypmodcoll
|
* get_atttypetypmodcoll
|
||||||
*
|
*
|
||||||
* A three-fer: given the relation id and the attribute number,
|
* A three-fer: given the relation id and the attribute number,
|
||||||
* fetch atttypid, atttypmod, and attcollation in a single cache lookup.
|
* fetch atttypid, atttypmod, and attcollation in a single cache lookup.
|
||||||
*
|
*
|
||||||
* Unlike the otherwise-similar get_atttype/get_atttypmod, this routine
|
* Unlike the otherwise-similar get_atttype, this routine
|
||||||
* raises an error if it can't obtain the information.
|
* raises an error if it can't obtain the information.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
|
@ -87,7 +87,6 @@ extern char *get_attname(Oid relid, AttrNumber attnum, bool missing_ok);
|
|||||||
extern AttrNumber get_attnum(Oid relid, const char *attname);
|
extern AttrNumber get_attnum(Oid relid, const char *attname);
|
||||||
extern char get_attidentity(Oid relid, AttrNumber attnum);
|
extern char get_attidentity(Oid relid, AttrNumber attnum);
|
||||||
extern Oid get_atttype(Oid relid, AttrNumber attnum);
|
extern Oid get_atttype(Oid relid, AttrNumber attnum);
|
||||||
extern int32 get_atttypmod(Oid relid, AttrNumber attnum);
|
|
||||||
extern void get_atttypetypmodcoll(Oid relid, AttrNumber attnum,
|
extern void get_atttypetypmodcoll(Oid relid, AttrNumber attnum,
|
||||||
Oid *typid, int32 *typmod, Oid *collid);
|
Oid *typid, int32 *typmod, Oid *collid);
|
||||||
extern char *get_collation_name(Oid colloid);
|
extern char *get_collation_name(Oid colloid);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user