Tweak the API for per-datatype typmodin functions so that they are passed
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 15 Jun 2007 20:56:52 +0000 (20:56 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 15 Jun 2007 20:56:52 +0000 (20:56 +0000)
an array of strings rather than an array of integers, and allow any simple
constant or identifier to be used in typmods; for example
create table foo (f1 widget(42,'23skidoo',point));
Of course the typmodin function has still got to pack this info into a
non-negative int32 for storage, but it's still a useful improvement in
flexibility, especially considering that you can do nearly anything if you
are willing to keep the info in a side table.  We can get away with this
change since we have not yet released a version providing user-definable
typmods.  Per discussion.

16 files changed:
doc/src/sgml/ref/create_type.sgml
src/backend/commands/typecmds.c
src/backend/parser/gram.y
src/backend/parser/parse_type.c
src/backend/utils/adt/arrayutils.c
src/backend/utils/adt/date.c
src/backend/utils/adt/numeric.c
src/backend/utils/adt/timestamp.c
src/backend/utils/adt/varbit.c
src/backend/utils/adt/varchar.c
src/include/catalog/catversion.h
src/include/catalog/pg_proc.h
src/include/catalog/pg_type.h
src/include/utils/array.h
src/test/regress/expected/type_sanity.out
src/test/regress/sql/type_sanity.sql

index 7a6254b0115f18054382905e0f7c40ce5daffda5..577936fdff49bab2f75fb3904eed95a3b5b67be9 100644 (file)
@@ -195,11 +195,11 @@ CREATE TYPE <replaceable class="parameter">name</replaceable>
    are needed if the type supports modifiers, that is optional constraints
    attached to a type declaration, such as <literal>char(5)</> or
    <literal>numeric(30,2)</>.  <productname>PostgreSQL</productname> allows
-   user-defined types to take one or more integer constants as modifiers;
-   however, this information must be capable of being packed into a single
-   non-negative integer value for storage in the system catalogs.  The
+   user-defined types to take one or more simple constants or identifiers as
+   modifiers; however, this information must be capable of being packed into a
+   single non-negative integer value for storage in the system catalogs.  The
    <replaceable class="parameter">type_modifier_input_function</replaceable>
-   is passed the declared modifier(s) in the form of an <type>integer</>
+   is passed the declared modifier(s) in the form of a <type>cstring</>
    array.  It must check the values for validity (throwing an error if they
    are wrong), and if they are correct, return a single non-negative
    <type>integer</> value that will be stored as the column <quote>typmod</>.
index 6acb2248f01226c8d0b52de687660bbc1bb28403..c835288680c1a8886d0c88245865b86d9f24c7ca 100644 (file)
@@ -1270,9 +1270,9 @@ findTypeTypmodinFunction(List *procname)
        Oid                     procOid;
 
        /*
-        * typmodin functions always take one int4[] argument and return int4.
+        * typmodin functions always take one cstring[] argument and return int4.
         */
-       argList[0] = INT4ARRAYOID;
+       argList[0] = CSTRINGARRAYOID;
 
        procOid = LookupFuncName(procname, 1, argList, true);
        if (!OidIsValid(procOid))
index dbe2dd3b98afa51209331e7055d7c7416465cd09..80fbb7cda356e8a09cac7d743c896eec5866d660 100644 (file)
@@ -6695,7 +6695,7 @@ ConstTypename:
  * by the standard, including qualified names.  We also allow type modifiers.
  * To avoid parsing conflicts against function invocations, the modifiers
  * have to be shown as expr_list here, but parse analysis will only accept
- * integer constants for them.
+ * constants for them.
  */
 GenericType:
                        type_function_name opt_type_modifiers
index cbe5d1044c776e6be8f38618f58301e63703c3ea..f03bbc890f99b8f2cb6dd4537b54aae81e1fb7dd 100644 (file)
@@ -289,28 +289,55 @@ typenameTypeMod(ParseState *pstate, const TypeName *typename,
                                 parser_errposition(pstate, typename->location)));
 
        /*
-        * Convert the list of (raw grammar output) expressions to an integer
-        * array.  Currently, we only allow simple integer constants, though
-        * possibly this could be extended.
+        * Convert the list of raw-grammar-output expressions to a cstring array.
+        * Currently, we allow simple numeric constants, string literals, and
+        * identifiers; possibly this list could be extended.
         */
        datums = (Datum *) palloc(list_length(typename->typmods) * sizeof(Datum));
        n = 0;
        foreach(l, typename->typmods)
        {
-               A_Const *ac = (A_Const *) lfirst(l);
+               Node    *tm = (Node *) lfirst(l);
+               char    *cstr = NULL;
 
-               if (!IsA(ac, A_Const) ||
-                       !IsA(&ac->val, Integer))
+               if (IsA(tm, A_Const))
+               {
+                       A_Const    *ac = (A_Const *) tm;
+
+                       /*
+                        * The grammar hands back some integers with ::int4 attached,
+                        * so allow a cast decoration if it's an Integer value, but
+                        * not otherwise.
+                        */
+                       if (IsA(&ac->val, Integer))
+                       {
+                               cstr = (char *) palloc(32);
+                               snprintf(cstr, 32, "%ld", (long) ac->val.val.ival);
+                       }
+                       else if (ac->typename == NULL)  /* no casts allowed */
+                       {
+                               /* otherwise we can just use the str field directly. */
+                               cstr = ac->val.val.str;
+                       }
+               }
+               else if (IsA(tm, ColumnRef))
+               {
+                       ColumnRef   *cr = (ColumnRef *) tm;
+
+                       if (list_length(cr->fields) == 1)
+                               cstr = strVal(linitial(cr->fields));
+               }
+               if (!cstr)
                        ereport(ERROR,
                                        (errcode(ERRCODE_SYNTAX_ERROR),
-                                        errmsg("type modifiers must be integer constants"),
+                                        errmsg("type modifiers must be simple constants or identifiers"),
                                         parser_errposition(pstate, typename->location)));
-               datums[n++] = Int32GetDatum(ac->val.val.ival);
+               datums[n++] = CStringGetDatum(cstr);
        }
 
-       /* hardwired knowledge about int4's representation details here */
-       arrtypmod = construct_array(datums, n, INT4OID,
-                                                               sizeof(int4), true, 'i');
+       /* hardwired knowledge about cstring's representation details here */
+       arrtypmod = construct_array(datums, n, CSTRINGOID,
+                                                               -2, false, 'c');
 
        result = DatumGetInt32(OidFunctionCall1(typmodin,
                                                                                        PointerGetDatum(arrtypmod)));
index 6cc33600f13294fcf99a3021d9a9a556d4173d99..f2c6b608c7b7ba8ec93a18f850d959eb5df21b03 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "catalog/pg_type.h"
 #include "utils/array.h"
+#include "utils/builtins.h"
 #include "utils/memutils.h"
 
 
@@ -191,16 +192,21 @@ mda_next_tuple(int n, int *curr, const int *span)
 }
 
 /*
- * ArrayGetTypmods: verify that argument is a 1-D integer array,
- * return its length and a pointer to the first contained integer.
+ * ArrayGetIntegerTypmods: verify that argument is a 1-D cstring array,
+ * and get the contents converted to integers.  Returns a palloc'd array
+ * and places the length at *n.
  */
 int32 *
-ArrayGetTypmods(ArrayType *arr, int *n)
+ArrayGetIntegerTypmods(ArrayType *arr, int *n)
 {
-       if (ARR_ELEMTYPE(arr) != INT4OID)
+       int32      *result;
+       Datum      *elem_values;
+       int                     i;
+
+       if (ARR_ELEMTYPE(arr) != CSTRINGOID)
                ereport(ERROR,
                                (errcode(ERRCODE_ARRAY_ELEMENT_ERROR),
-                                errmsg("typmod array must be type integer[]")));
+                                errmsg("typmod array must be type cstring[]")));
 
        if (ARR_NDIM(arr) != 1)
                ereport(ERROR,
@@ -212,7 +218,18 @@ ArrayGetTypmods(ArrayType *arr, int *n)
                                (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
                                 errmsg("typmod array must not contain nulls")));
 
-       *n = ArrayGetNItems(ARR_NDIM(arr), ARR_DIMS(arr));
+       /* hardwired knowledge about cstring's representation details here */
+       deconstruct_array(arr, CSTRINGOID,
+                                         -2, false, 'c',
+                                         &elem_values, NULL, n);
+
+       result = (int32 *) palloc(*n * sizeof(int32));
+
+       for (i = 0; i < *n; i++)
+               result[i] = pg_atoi(DatumGetCString(elem_values[i]),
+                                                       sizeof(int32), '\0');
+
+       pfree(elem_values);
 
-       return (int32 *) ARR_DATA_PTR(arr);
+       return result;
 }
index 1ba4f7533c1292ac73bd08ea436f611c30fd8491..19b7884e0339f30bcf23b06d69590707274771c2 100644 (file)
@@ -53,7 +53,7 @@ anytime_typmodin(bool istz, ArrayType *ta)
        int32   *tl;
        int             n;
 
-       tl = ArrayGetTypmods(ta, &n);
+       tl = ArrayGetIntegerTypmods(ta, &n);
 
        /*
         * we're not too tense about good error message here because grammar
index 5ac306209a47ae048273d8869409b683e2b45d4b..4e295d870fdb87a94c0a69abba29c7951ed3478a 100644 (file)
@@ -547,7 +547,7 @@ numerictypmodin(PG_FUNCTION_ARGS)
        int                     n;
        int32           typmod;
 
-       tl = ArrayGetTypmods(ta, &n);
+       tl = ArrayGetIntegerTypmods(ta, &n);
 
        if (n == 2)
        {
index c3caaa2933ece06c33955268d0a70011f41b5ef8..974e4a9d10ec382ee9544ec39ff44946900b68d7 100644 (file)
@@ -64,7 +64,7 @@ anytimestamp_typmodin(bool istz, ArrayType *ta)
        int32    *tl;
        int             n;
 
-       tl = ArrayGetTypmods(ta, &n);
+       tl = ArrayGetIntegerTypmods(ta, &n);
 
        /*
         * we're not too tense about good error message here because grammar
@@ -719,7 +719,7 @@ intervaltypmodin(PG_FUNCTION_ARGS)
     int                n;
        int32           typmod;
 
-       tl = ArrayGetTypmods(ta, &n);
+       tl = ArrayGetIntegerTypmods(ta, &n);
 
        /*
         * tl[0] - opt_interval
index 477feaf65a5f7832c9e1491dd1160acfec697b1c..ca622e47a55f714c3d10ff84f02b40692a80d610 100644 (file)
@@ -32,7 +32,7 @@ anybit_typmodin(ArrayType *ta, const char *typename)
        int32   *tl;
        int             n;
 
-       tl = ArrayGetTypmods(ta, &n);
+       tl = ArrayGetIntegerTypmods(ta, &n);
 
        /*
         * we're not too tense about good error message here because grammar
index e917d69a5f0ecf1e5813d8f4e78dcfd51fdfa63e..7a49ed019eed0813ea74d3c15d9aa78bc21755c7 100644 (file)
@@ -31,7 +31,7 @@ anychar_typmodin(ArrayType *ta, const char *typename)
        int32   *tl;
        int             n;
 
-       tl = ArrayGetTypmods(ta, &n);
+       tl = ArrayGetIntegerTypmods(ta, &n);
 
        /*
         * we're not too tense about good error message here because grammar
index 67aa3cf29ca552c4e7e12ef74249dead25c2dc84..1562c0e47df5b2a4d0e8683982c55ff1a96e9c30 100644 (file)
@@ -53,6 +53,6 @@
  */
 
 /*                                                     yyyymmddN */
-#define CATALOG_VERSION_NO     200706061
+#define CATALOG_VERSION_NO     200706151
 
 #endif
index e605f65e02fb79a2f112837d61b5fed0164df0ad..37ed4e3befa3f6d1a86c5c598dfc74356ed7e62b 100644 (file)
@@ -1308,7 +1308,7 @@ DATA(insert OID = 1044 (  bpcharin                   PGNSP PGUID 12 1 0 f f t f i 3 1042 "2275
 DESCR("I/O");
 DATA(insert OID = 1045 (  bpcharout               PGNSP PGUID 12 1 0 f f t f i 1 2275 "1042" _null_ _null_ _null_      bpcharout - _null_ ));
 DESCR("I/O");
-DATA(insert OID = 2913 (  bpchartypmodin   PGNSP PGUID 12 1 0 f f t f i 1 23 "1007" _null_ _null_ _null_       bpchartypmodin - _null_ ));
+DATA(insert OID = 2913 (  bpchartypmodin   PGNSP PGUID 12 1 0 f f t f i 1 23 "1263" _null_ _null_ _null_       bpchartypmodin - _null_ ));
 DESCR("I/O typmod");
 DATA(insert OID = 2914 (  bpchartypmodout  PGNSP PGUID 12 1 0 f f t f i 1 2275 "23" _null_ _null_ _null_       bpchartypmodout - _null_ ));
 DESCR("I/O typmod");
@@ -1316,7 +1316,7 @@ DATA(insert OID = 1046 (  varcharin                  PGNSP PGUID 12 1 0 f f t f i 3 1043 "227
 DESCR("I/O");
 DATA(insert OID = 1047 (  varcharout      PGNSP PGUID 12 1 0 f f t f i 1 2275 "1043" _null_ _null_ _null_      varcharout - _null_ ));
 DESCR("I/O");
-DATA(insert OID = 2915 (  varchartypmodin  PGNSP PGUID 12 1 0 f f t f i 1 23 "1007" _null_ _null_ _null_       varchartypmodin - _null_ ));
+DATA(insert OID = 2915 (  varchartypmodin  PGNSP PGUID 12 1 0 f f t f i 1 23 "1263" _null_ _null_ _null_       varchartypmodin - _null_ ));
 DESCR("I/O typmod");
 DATA(insert OID = 2916 (  varchartypmodout PGNSP PGUID 12 1 0 f f t f i 1 2275 "23" _null_ _null_ _null_       varchartypmodout - _null_ ));
 DESCR("I/O typmod");
@@ -1389,7 +1389,7 @@ DATA(insert OID = 1143 (  time_in            PGNSP PGUID 12 1 0 f f t f s 3 1083 "2275
 DESCR("I/O");
 DATA(insert OID = 1144 (  time_out                PGNSP PGUID 12 1 0 f f t f i 1 2275 "1083" _null_ _null_ _null_      time_out - _null_ ));
 DESCR("I/O");
-DATA(insert OID = 2909 (  timetypmodin         PGNSP PGUID 12 1 0 f f t f i 1 23 "1007" _null_ _null_ _null_   timetypmodin - _null_ ));
+DATA(insert OID = 2909 (  timetypmodin         PGNSP PGUID 12 1 0 f f t f i 1 23 "1263" _null_ _null_ _null_   timetypmodin - _null_ ));
 DESCR("I/O typmod");
 DATA(insert OID = 2910 (  timetypmodout        PGNSP PGUID 12 1 0 f f t f i 1 2275 "23" _null_ _null_ _null_   timetypmodout - _null_ ));
 DESCR("I/O typmod");
@@ -1409,7 +1409,7 @@ DATA(insert OID = 1150 (  timestamptz_in   PGNSP PGUID 12 1 0 f f t f s 3 1184 "
 DESCR("I/O");
 DATA(insert OID = 1151 (  timestamptz_out  PGNSP PGUID 12 1 0 f f t f s 1 2275 "1184" _null_ _null_ _null_     timestamptz_out - _null_ ));
 DESCR("I/O");
-DATA(insert OID = 2907 (  timestamptztypmodin          PGNSP PGUID 12 1 0 f f t f i 1 23 "1007" _null_ _null_ _null_   timestamptztypmodin - _null_ ));
+DATA(insert OID = 2907 (  timestamptztypmodin          PGNSP PGUID 12 1 0 f f t f i 1 23 "1263" _null_ _null_ _null_   timestamptztypmodin - _null_ ));
 DESCR("I/O typmod");
 DATA(insert OID = 2908 (  timestamptztypmodout         PGNSP PGUID 12 1 0 f f t f i 1 2275 "23" _null_ _null_ _null_   timestamptztypmodout - _null_ ));
 DESCR("I/O typmod");
@@ -1434,7 +1434,7 @@ DATA(insert OID = 1160 (  interval_in        PGNSP PGUID 12 1 0 f f t f s 3 1186 "22
 DESCR("I/O");
 DATA(insert OID = 1161 (  interval_out    PGNSP PGUID 12 1 0 f f t f i 1 2275 "1186" _null_ _null_ _null_      interval_out - _null_ ));
 DESCR("I/O");
-DATA(insert OID = 2903 (  intervaltypmodin     PGNSP PGUID 12 1 0 f f t f i 1 23 "1007" _null_ _null_ _null_   intervaltypmodin - _null_ ));
+DATA(insert OID = 2903 (  intervaltypmodin     PGNSP PGUID 12 1 0 f f t f i 1 23 "1263" _null_ _null_ _null_   intervaltypmodin - _null_ ));
 DESCR("I/O typmod");
 DATA(insert OID = 2904 (  intervaltypmodout    PGNSP PGUID 12 1 0 f f t f i 1 2275 "23" _null_ _null_ _null_   intervaltypmodout - _null_ ));
 DESCR("I/O typmod");
@@ -1644,7 +1644,7 @@ DATA(insert OID = 1312 (  timestamp_in             PGNSP PGUID 12 1 0 f f t f s 3 1114 "22
 DESCR("I/O");
 DATA(insert OID = 1313 (  timestamp_out                 PGNSP PGUID 12 1 0 f f t f s 1 2275 "1114" _null_ _null_ _null_ timestamp_out - _null_ ));
 DESCR("I/O");
-DATA(insert OID = 2905 (  timestamptypmodin    PGNSP PGUID 12 1 0 f f t f i 1 23 "1007" _null_ _null_ _null_   timestamptypmodin - _null_ ));
+DATA(insert OID = 2905 (  timestamptypmodin    PGNSP PGUID 12 1 0 f f t f i 1 23 "1263" _null_ _null_ _null_   timestamptypmodin - _null_ ));
 DESCR("I/O typmod");
 DATA(insert OID = 2906 (  timestamptypmodout   PGNSP PGUID 12 1 0 f f t f i 1 2275 "23" _null_ _null_ _null_   timestamptypmodout - _null_ ));
 DESCR("I/O typmod");
@@ -1701,7 +1701,7 @@ DATA(insert OID = 1350 (  timetz_in                  PGNSP PGUID 12 1 0 f f t f s 3 1266 "227
 DESCR("I/O");
 DATA(insert OID = 1351 (  timetz_out      PGNSP PGUID 12 1 0 f f t f i 1 2275 "1266" _null_ _null_ _null_      timetz_out - _null_ ));
 DESCR("I/O");
-DATA(insert OID = 2911 (  timetztypmodin       PGNSP PGUID 12 1 0 f f t f i 1 23 "1007" _null_ _null_ _null_   timetztypmodin - _null_ ));
+DATA(insert OID = 2911 (  timetztypmodin       PGNSP PGUID 12 1 0 f f t f i 1 23 "1263" _null_ _null_ _null_   timetztypmodin - _null_ ));
 DESCR("I/O typmod");
 DATA(insert OID = 2912 (  timetztypmodout      PGNSP PGUID 12 1 0 f f t f i 1 2275 "23" _null_ _null_ _null_   timetztypmodout - _null_ ));
 DESCR("I/O typmod");
@@ -2033,7 +2033,7 @@ DATA(insert OID = 1564 (  bit_in                  PGNSP PGUID 12 1 0 f f t f i 3 1560 "2275 26
 DESCR("I/O");
 DATA(insert OID = 1565 (  bit_out                      PGNSP PGUID 12 1 0 f f t f i 1 2275 "1560" _null_ _null_ _null_ bit_out - _null_ ));
 DESCR("I/O");
-DATA(insert OID = 2919 (  bittypmodin          PGNSP PGUID 12 1 0 f f t f i 1 23 "1007" _null_ _null_ _null_   bittypmodin - _null_ ));
+DATA(insert OID = 2919 (  bittypmodin          PGNSP PGUID 12 1 0 f f t f i 1 23 "1263" _null_ _null_ _null_   bittypmodin - _null_ ));
 DESCR("I/O typmod");
 DATA(insert OID = 2920 (  bittypmodout         PGNSP PGUID 12 1 0 f f t f i 1 2275 "23" _null_ _null_ _null_   bittypmodout - _null_ ));
 DESCR("I/O typmod");
@@ -2062,7 +2062,7 @@ DATA(insert OID = 1579 (  varbit_in                       PGNSP PGUID 12 1 0 f f t f i 3 1562 "2275
 DESCR("I/O");
 DATA(insert OID = 1580 (  varbit_out           PGNSP PGUID 12 1 0 f f t f i 1 2275 "1562" _null_ _null_ _null_ varbit_out - _null_ ));
 DESCR("I/O");
-DATA(insert OID = 2902 (  varbittypmodin       PGNSP PGUID 12 1 0 f f t f i 1 23 "1007" _null_ _null_ _null_   varbittypmodin - _null_ ));
+DATA(insert OID = 2902 (  varbittypmodin       PGNSP PGUID 12 1 0 f f t f i 1 23 "1263" _null_ _null_ _null_   varbittypmodin - _null_ ));
 DESCR("I/O typmod");
 DATA(insert OID = 2921 (  varbittypmodout      PGNSP PGUID 12 1 0 f f t f i 1 2275 "23" _null_ _null_ _null_   varbittypmodout - _null_ ));
 DESCR("I/O typmod");
@@ -2485,7 +2485,7 @@ DATA(insert OID = 1701 ( numeric_in                               PGNSP PGUID 12 1 0 f f t f i 3 1700 "2275
 DESCR("I/O");
 DATA(insert OID = 1702 ( numeric_out                   PGNSP PGUID 12 1 0 f f t f i 1 2275 "1700" _null_ _null_ _null_ numeric_out - _null_ ));
 DESCR("I/O");
-DATA(insert OID = 2917 (  numerictypmodin      PGNSP PGUID 12 1 0 f f t f i 1 23 "1007" _null_ _null_ _null_   numerictypmodin - _null_ ));
+DATA(insert OID = 2917 (  numerictypmodin      PGNSP PGUID 12 1 0 f f t f i 1 23 "1263" _null_ _null_ _null_   numerictypmodin - _null_ ));
 DESCR("I/O typmod");
 DATA(insert OID = 2918 (  numerictypmodout     PGNSP PGUID 12 1 0 f f t f i 1 2275 "23" _null_ _null_ _null_   numerictypmodout - _null_ ));
 DESCR("I/O typmod");
index afbc3fc84445bbcb564ba074c57b74fefd60e158..931561894379e6d29207f28f9b019fc3fb499983 100644 (file)
@@ -451,8 +451,11 @@ DESCR("access control list");
 #define ACLITEMOID             1033
 DATA(insert OID = 1034 (  _aclitem      PGNSP PGUID -1 f b t \054 0 1033 0 array_in array_out array_recv array_send - - - i x f 0 -1 0 _null_ _null_ ));
 DATA(insert OID = 1040 (  _macaddr      PGNSP PGUID -1 f b t \054 0  829 0 array_in array_out array_recv array_send - - - i x f 0 -1 0 _null_ _null_ ));
-DATA(insert OID = 1041 (  _inet    PGNSP PGUID -1 f b t \054 0 869 0 array_in array_out array_recv array_send - - - i x f 0 -1 0 _null_ _null_ ));
-DATA(insert OID = 651  (  _cidr    PGNSP PGUID -1 f b t \054 0 650 0 array_in array_out array_recv array_send - - - i x f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 1041 (  _inet                 PGNSP PGUID -1 f b t \054 0  869 0 array_in array_out array_recv array_send - - - i x f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 651  (  _cidr                 PGNSP PGUID -1 f b t \054 0  650 0 array_in array_out array_recv array_send - - - i x f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 1263 (  _cstring      PGNSP PGUID -1 f b t \054 0 2275 0 array_in array_out array_recv array_send - - - i x f 0 -1 0 _null_ _null_ ));
+#define CSTRINGARRAYOID                1263
+
 DATA(insert OID = 1042 ( bpchar                 PGNSP PGUID -1 f b t \054 0    0 1014 bpcharin bpcharout bpcharrecv bpcharsend bpchartypmodin bpchartypmodout - i x f 0 -1 0 _null_ _null_ ));
 DESCR("char(length), blank-padded string, fixed storage length");
 #define BPCHAROID              1042
@@ -554,10 +557,14 @@ DATA(insert OID = 2951 ( _uuid                    PGNSP PGUID -1 f b t \054 0 2950 0 array_in arr
  * These cannot be used to define table columns, but are valid as function
  * argument and result types (if supported by the function's implementation
  * language).
+ *
+ * Note: cstring is a borderline case; it is still considered a pseudo-type,
+ * but there is now support for it in records and arrays.  Perhaps we should
+ * just treat it as a regular base type?
  */
 DATA(insert OID = 2249 ( record                        PGNSP PGUID -1 f p t \054 0 0 0 record_in record_out record_recv record_send - - - d x f 0 -1 0 _null_ _null_ ));
 #define RECORDOID              2249
-DATA(insert OID = 2275 ( cstring               PGNSP PGUID -2 f p t \054 0 0 0 cstring_in cstring_out cstring_recv cstring_send - - - c p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 2275 ( cstring               PGNSP PGUID -2 f p t \054 0 0 1263 cstring_in cstring_out cstring_recv cstring_send - - - c p f 0 -1 0 _null_ _null_ ));
 #define CSTRINGOID             2275
 DATA(insert OID = 2276 ( any                   PGNSP PGUID  4 t p t \054 0 0 0 any_in any_out - - - - - i p f 0 -1 0 _null_ _null_ ));
 #define ANYOID                 2276
index d2c091ed8d66c0ce9f2fb77d3fcb1719efeb2c5f..3c0d24297176c1e480509a78974b81e927825de1 100644 (file)
@@ -256,7 +256,7 @@ extern void mda_get_range(int n, int *span, const int *st, const int *endp);
 extern void mda_get_prod(int n, const int *range, int *prod);
 extern void mda_get_offset_values(int n, int *dist, const int *prod, const int *span);
 extern int     mda_next_tuple(int n, int *curr, const int *span);
-extern int32 *ArrayGetTypmods(ArrayType *arr, int *n);
+extern int32 *ArrayGetIntegerTypmods(ArrayType *arr, int *n);
 
 /*
  * prototypes for functions defined in array_userfuncs.c
index 702cf7eecf1003a9b73c049196ccf963a675f4c0..2a551a7d0b89b332631d47f11a4d1f209f6abf06 100644 (file)
@@ -227,7 +227,7 @@ SELECT p1.oid, p1.typname, p2.oid, p2.proname
 FROM pg_type AS p1, pg_proc AS p2
 WHERE p1.typmodin = p2.oid AND p1.typtype in ('b', 'p') AND NOT
     (p2.pronargs = 1 AND
-     p2.proargtypes[0] = 'int4[]'::regtype AND
+     p2.proargtypes[0] = 'cstring[]'::regtype AND
      p2.prorettype = 'int4'::regtype AND NOT p2.proretset);
  oid | typname | oid | proname 
 -----+---------+-----+---------
index e549fd74892b7ddd9d4868cb5d61dc33fae1af3d..d0967e69c92cc09d606bb35e53a19b392c6fa183 100644 (file)
@@ -176,7 +176,7 @@ SELECT p1.oid, p1.typname, p2.oid, p2.proname
 FROM pg_type AS p1, pg_proc AS p2
 WHERE p1.typmodin = p2.oid AND p1.typtype in ('b', 'p') AND NOT
     (p2.pronargs = 1 AND
-     p2.proargtypes[0] = 'int4[]'::regtype AND
+     p2.proargtypes[0] = 'cstring[]'::regtype AND
      p2.prorettype = 'int4'::regtype AND NOT p2.proretset);
 
 -- Check for bogus typmodout routines