]> granicus.if.org Git - postgresql/blobdiff - src/backend/utils/adt/format_type.c
Revert addition of third argument to format_type().
[postgresql] / src / backend / utils / adt / format_type.c
index a0ea23307a13e324667212b97f9fd2e6e5743ef1..b56bb74bdc6db437f8155ba10ca5e5360bb23ff4 100644 (file)
@@ -4,11 +4,11 @@
  *       Display type names "nicely".
  *
  *
- * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/adt/format_type.c,v 1.51 2009/01/01 17:23:49 momjian Exp $
+ *       src/backend/utils/adt/format_type.c
  *
  *-------------------------------------------------------------------------
  */
@@ -123,9 +123,7 @@ format_type_internal(Oid type_oid, int32 typemod,
        if (type_oid == InvalidOid && allow_invalid)
                return pstrdup("-");
 
-       tuple = SearchSysCache(TYPEOID,
-                                                  ObjectIdGetDatum(type_oid),
-                                                  0, 0, 0);
+       tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type_oid));
        if (!HeapTupleIsValid(tuple))
        {
                if (allow_invalid)
@@ -136,24 +134,20 @@ format_type_internal(Oid type_oid, int32 typemod,
        typeform = (Form_pg_type) GETSTRUCT(tuple);
 
        /*
-        * Check if it's an array (and not a domain --- we don't want to show the
-        * substructure of a domain type).      Fixed-length array types such as
-        * "name" shouldn't get deconstructed either.  As of Postgres 8.1, rather
-        * than checking typlen we check the toast property, and don't deconstruct
-        * "plain storage" array types --- this is because we don't want to show
-        * oidvector as oid[].
+        * Check if it's a regular (variable length) array type.  Fixed-length
+        * array types such as "name" shouldn't get deconstructed.  As of Postgres
+        * 8.1, rather than checking typlen we check the toast property, and don't
+        * deconstruct "plain storage" array types --- this is because we don't
+        * want to show oidvector as oid[].
         */
        array_base_type = typeform->typelem;
 
        if (array_base_type != InvalidOid &&
-               typeform->typstorage != 'p' &&
-               typeform->typtype != TYPTYPE_DOMAIN)
+               typeform->typstorage != 'p')
        {
                /* Switch our attention to the array element type */
                ReleaseSysCache(tuple);
-               tuple = SearchSysCache(TYPEOID,
-                                                          ObjectIdGetDatum(array_base_type),
-                                                          0, 0, 0);
+               tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(array_base_type));
                if (!HeapTupleIsValid(tuple))
                {
                        if (allow_invalid)
@@ -391,15 +385,7 @@ type_maximum_size(Oid type_oid, int32 typemod)
                                + VARHDRSZ;
 
                case NUMERICOID:
-                       /* precision (ie, max # of digits) is in upper bits of typmod */
-                       if (typemod > VARHDRSZ)
-                       {
-                               int                     precision = ((typemod - VARHDRSZ) >> 16) & 0xffff;
-
-                               /* Numeric stores 2 decimal digits/byte, plus header */
-                               return (precision + 1) / 2 + NUMERIC_HDRSZ;
-                       }
-                       break;
+                       return numeric_maximum_size(typemod);
 
                case VARBITOID:
                case BITOID: