Remove get_atttypmod()
authorPeter Eisentraut <peter_e@gmx.net>
Thu, 18 Oct 2018 17:28:28 +0000 (19:28 +0200)
committerPeter Eisentraut <peter_e@gmx.net>
Tue, 23 Oct 2018 12:47:14 +0000 (14:47 +0200)
This has been unused since 2004.  get_atttypetypmodcoll() is often a
better alternative.

Reviewed-by: Michael Paquier <michael@paquier.xyz>
src/backend/utils/cache/lsyscache.c
src/include/utils/lsyscache.h

index 12b2532d95725e2ffd0d142b480a8b958d2ad734..c53bda9867122a1a3a667e70c47a281da9fdd70f 100644 (file)
@@ -880,40 +880,13 @@ get_atttype(Oid relid, AttrNumber attnum)
        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
  *
  *     A three-fer: given the relation id and the attribute number,
  *     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.
  */
 void
index 8c57de77c0656ab45cde6234e0149f92502ca25b..23ed5324b5bbdf507bb6be9e42a4a47990338579 100644 (file)
@@ -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 char get_attidentity(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,
                      Oid *typid, int32 *typmod, Oid *collid);
 extern char *get_collation_name(Oid colloid);