Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e8e746d

Browse files
committed
Establish the rule that array types should have the same typdelim as their
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.
1 parent 436e6af commit e8e746d

File tree

5 files changed

+20
-6
lines changed

5 files changed

+20
-6
lines changed

src/backend/commands/typecmds.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.123 2008/08/28 23:09:45 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.124 2008/09/25 03:28:56 tgl Exp $
1212
*
1313
* DESCRIPTION
1414
* The "DefineFoo" routines take the parse tree and pick out the
@@ -497,7 +497,7 @@ DefineType(List *names, List *parameters)
497497
TYPTYPE_BASE, /* type-type (base type) */
498498
TYPCATEGORY_ARRAY, /* type-category (array) */
499499
false, /* array types are never preferred */
500-
DEFAULT_TYPDELIM, /* array element delimiter */
500+
delimiter, /* array element delimiter */
501501
F_ARRAY_IN, /* input procedure */
502502
F_ARRAY_OUT, /* output procedure */
503503
F_ARRAY_RECV, /* receive procedure */

src/include/catalog/catversion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
3838
* Portions Copyright (c) 1994, Regents of the University of California
3939
*
40-
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.488 2008/09/23 09:20:38 heikki Exp $
40+
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.489 2008/09/25 03:28:56 tgl Exp $
4141
*
4242
*-------------------------------------------------------------------------
4343
*/
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/* yyyymmddN */
56-
#define CATALOG_VERSION_NO 200809231
56+
#define CATALOG_VERSION_NO 200809241
5757

5858
#endif

src/include/catalog/pg_type.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
99
* Portions Copyright (c) 1994, Regents of the University of California
1010
*
11-
* $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.199 2008/07/30 19:35:13 tgl Exp $
11+
* $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.200 2008/09/25 03:28:56 tgl Exp $
1212
*
1313
* NOTES
1414
* 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
446446
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_ ));
447447
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_ ));
448448
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_ ));
449-
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_ ));
449+
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_ ));
450450
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_ ));
451451
#define FLOAT4ARRAYOID 1021
452452
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_ ));

src/test/regress/expected/type_sanity.out

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,14 @@ WHERE p1.typelem = p2.oid AND NOT
254254
-----+---------+-----+---------
255255
(0 rows)
256256

257+
-- Array types should have same typdelim as their element types
258+
SELECT p1.oid, p1.typname, p2.oid, p2.typname
259+
FROM pg_type AS p1, pg_type AS p2
260+
WHERE p1.typarray = p2.oid AND NOT (p1.typdelim = p2.typdelim);
261+
oid | typname | oid | typname
262+
-----+---------+-----+---------
263+
(0 rows)
264+
257265
-- Check for bogus typanalyze routines
258266
SELECT p1.oid, p1.typname, p2.oid, p2.proname
259267
FROM pg_type AS p1, pg_proc AS p2

src/test/regress/sql/type_sanity.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,12 @@ FROM pg_type AS p1, pg_type AS p2
196196
WHERE p1.typelem = p2.oid AND NOT
197197
(p1.typmodin = p2.typmodin AND p1.typmodout = p2.typmodout);
198198

199+
-- Array types should have same typdelim as their element types
200+
201+
SELECT p1.oid, p1.typname, p2.oid, p2.typname
202+
FROM pg_type AS p1, pg_type AS p2
203+
WHERE p1.typarray = p2.oid AND NOT (p1.typdelim = p2.typdelim);
204+
199205
-- Check for bogus typanalyze routines
200206

201207
SELECT p1.oid, p1.typname, p2.oid, p2.proname

0 commit comments

Comments
 (0)