Establish the rule that array types should have the same typdelim as their
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 25 Sep 2008 03:28:56 +0000 (03:28 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 25 Sep 2008 03:28:56 +0000 (03:28 +0000)
element types.  Since the backend doesn't actually pay attention to the array
type's delimiter, this has no functional effect, but it seems better for the
catalog entries to be consistent.  Per gripe from Greg Mullane and subsequent
discussion.

src/backend/commands/typecmds.c
src/include/catalog/catversion.h
src/include/catalog/pg_type.h
src/test/regress/expected/type_sanity.out
src/test/regress/sql/type_sanity.sql

index c0dc74bee79d91159f842183f2d0b8c60aa6e22a..3e573bc3943083c6287e47870218cbbcdc8f99bd 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.123 2008/08/28 23:09:45 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.124 2008/09/25 03:28:56 tgl Exp $
  *
  * DESCRIPTION
  *   The "DefineFoo" routines take the parse tree and pick out the
@@ -497,7 +497,7 @@ DefineType(List *names, List *parameters)
               TYPTYPE_BASE,    /* type-type (base type) */
               TYPCATEGORY_ARRAY, /* type-category (array) */
               false,           /* array types are never preferred */
-              DEFAULT_TYPDELIM,    /* array element delimiter */
+              delimiter,       /* array element delimiter */
               F_ARRAY_IN,      /* input procedure */
               F_ARRAY_OUT,     /* output procedure */
               F_ARRAY_RECV,    /* receive procedure */
index e7f96f78c14e7b6cc3b80e38d3fbf6593dc03d73..d066cf6671d18f9eb74db92e3c069599b0bc1682 100644 (file)
@@ -37,7 +37,7 @@
  * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.488 2008/09/23 09:20:38 heikki Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.489 2008/09/25 03:28:56 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -53,6 +53,6 @@
  */
 
 /*                         yyyymmddN */
-#define CATALOG_VERSION_NO 200809231
+#define CATALOG_VERSION_NO 200809241
 
 #endif
index 8e82997b7350372854fdce2bf230e1b04f725fe5..d4f4fc0968baafdeb9c829a72fa9207523d12252 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.199 2008/07/30 19:35:13 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.200 2008/09/25 03:28:56 tgl Exp $
  *
  * NOTES
  *   the genbki.sh script reads this file and generates .bki
@@ -446,7 +446,7 @@ DATA(insert OID = 1016 (  _int8      PGNSP PGUID -1 f b A f t \054 0    20 0 array_in
 DATA(insert OID = 1017 (  _point    PGNSP PGUID -1 f b A f t \054 0 600 0 array_in array_out array_recv array_send - - - d x f 0 -1 0 _null_ _null_ ));
 DATA(insert OID = 1018 (  _lseg         PGNSP PGUID -1 f b A f t \054 0 601 0 array_in array_out array_recv array_send - - - d x f 0 -1 0 _null_ _null_ ));
 DATA(insert OID = 1019 (  _path         PGNSP PGUID -1 f b A f t \054 0 602 0 array_in array_out array_recv array_send - - - d x f 0 -1 0 _null_ _null_ ));
-DATA(insert OID = 1020 (  _box      PGNSP PGUID -1 f b A f t \054 0 603 0 array_in array_out array_recv array_send - - - d x f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 1020 (  _box      PGNSP PGUID -1 f b A f t \073 0 603 0 array_in array_out array_recv array_send - - - d x f 0 -1 0 _null_ _null_ ));
 DATA(insert OID = 1021 (  _float4   PGNSP PGUID -1 f b A f t \054 0 700 0 array_in array_out array_recv array_send - - - i x f 0 -1 0 _null_ _null_ ));
 #define FLOAT4ARRAYOID 1021
 DATA(insert OID = 1022 (  _float8   PGNSP PGUID -1 f b A f t \054 0 701 0 array_in array_out array_recv array_send - - - d x f 0 -1 0 _null_ _null_ ));
index 48b51466061ab0b745895c159b113283bf604586..be86ee313be3c3bf2b80f1403f8416c5a9eac827 100644 (file)
@@ -254,6 +254,14 @@ WHERE p1.typelem = p2.oid AND NOT
 -----+---------+-----+---------
 (0 rows)
 
+-- Array types should have same typdelim as their element types
+SELECT p1.oid, p1.typname, p2.oid, p2.typname
+FROM pg_type AS p1, pg_type AS p2
+WHERE p1.typarray = p2.oid AND NOT (p1.typdelim = p2.typdelim);
+ oid | typname | oid | typname 
+-----+---------+-----+---------
+(0 rows)
+
 -- Check for bogus typanalyze routines
 SELECT p1.oid, p1.typname, p2.oid, p2.proname
 FROM pg_type AS p1, pg_proc AS p2
index e28fccab6c92c86dbf868bc69ade321fa07274b5..265ef5e26e2f33d954c935f3ab8afeba9c6d7899 100644 (file)
@@ -196,6 +196,12 @@ FROM pg_type AS p1, pg_type AS p2
 WHERE p1.typelem = p2.oid AND NOT
     (p1.typmodin = p2.typmodin AND p1.typmodout = p2.typmodout);
 
+-- Array types should have same typdelim as their element types
+
+SELECT p1.oid, p1.typname, p2.oid, p2.typname
+FROM pg_type AS p1, pg_type AS p2
+WHERE p1.typarray = p2.oid AND NOT (p1.typdelim = p2.typdelim);
+
 -- Check for bogus typanalyze routines
 
 SELECT p1.oid, p1.typname, p2.oid, p2.proname