diff options
| author | Tom Lane | 2007-06-15 20:56:52 +0000 |
|---|---|---|
| committer | Tom Lane | 2007-06-15 20:56:52 +0000 |
| commit | 23347231a53bc373710db71559a194d87f60a7cb (patch) | |
| tree | 04c6e8af0afb299a0a112da5c92124a377d1abb3 /src/include | |
| parent | 839fcc9fd09452c406b67fb2e1af87d55d0ad4e2 (diff) | |
Tweak the API for per-datatype typmodin functions so that they are passed
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.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/catalog/catversion.h | 4 | ||||
| -rw-r--r-- | src/include/catalog/pg_proc.h | 22 | ||||
| -rw-r--r-- | src/include/catalog/pg_type.h | 15 | ||||
| -rw-r--r-- | src/include/utils/array.h | 4 |
4 files changed, 26 insertions, 19 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 8dfca8ecc72..415af0e6cb2 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -37,7 +37,7 @@ * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.411 2007/06/06 23:00:40 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.412 2007/06/15 20:56:51 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 200706061 +#define CATALOG_VERSION_NO 200706151 #endif diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index 49c1429e377..11e13b36aae 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.459 2007/06/06 23:00:41 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.460 2007/06/15 20:56:51 tgl Exp $ * * NOTES * The script catalog/genbki.sh reads this file and generates .bki @@ -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"); diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h index 753487348b4..01db6c616fc 100644 --- a/src/include/catalog/pg_type.h +++ b/src/include/catalog/pg_type.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.185 2007/06/06 23:00:43 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.186 2007/06/15 20:56:52 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -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 diff --git a/src/include/utils/array.h b/src/include/utils/array.h index 534adef53f6..69a2178cf53 100644 --- a/src/include/utils/array.h +++ b/src/include/utils/array.h @@ -49,7 +49,7 @@ * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/array.h,v 1.64 2007/03/27 23:21:12 tgl Exp $ + * $PostgreSQL: pgsql/src/include/utils/array.h,v 1.65 2007/06/15 20:56:52 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -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 |
