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

Commit 59c016a

Browse files
committed
Pass the type OID as the typioparam for all non-array types, rather than
only composite types as we did in 8.0. Per discussion with Martijn van Oosterhout.
1 parent bb2ffe9 commit 59c016a

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

doc/src/sgml/ref/create_type.sgml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/create_type.sgml,v 1.57 2005/07/14 06:17:36 neilc Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/create_type.sgml,v 1.58 2005/08/12 21:49:46 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -103,8 +103,8 @@ CREATE TYPE <replaceable class="parameter">name</replaceable> (
103103
or as taking three arguments of types
104104
<type>cstring</type>, <type>oid</type>, <type>integer</type>.
105105
The first argument is the input text as a C string, the second
106-
argument is the element type's OID in case this is an array type
107-
(or the type's own OID for a composite type),
106+
argument is the type's own OID (except for array types, which instead
107+
receive their element type's OID),
108108
and the third is the <literal>typmod</> of the destination column, if known
109109
(-1 will be passed if not).
110110
The input function must return a value of the data type itself.

src/backend/utils/cache/lsyscache.c

+7-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/utils/cache/lsyscache.c,v 1.126 2005/06/28 05:09:01 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/utils/cache/lsyscache.c,v 1.127 2005/08/12 21:49:47 tgl Exp $
1111
*
1212
* NOTES
1313
* Eventually, the index information should go through here, too.
@@ -1223,13 +1223,14 @@ getTypeIOParam(HeapTuple typeTuple)
12231223
Form_pg_type typeStruct = (Form_pg_type) GETSTRUCT(typeTuple);
12241224

12251225
/*
1226-
* Composite types get their own OID as parameter; array types get
1227-
* their typelem as parameter; everybody else gets zero.
1226+
* Array types get their typelem as parameter; everybody else gets
1227+
* their own type OID as parameter. (This is a change from 8.0,
1228+
* in which only composite types got their own OID as parameter.)
12281229
*/
1229-
if (typeStruct->typtype == 'c')
1230-
return HeapTupleGetOid(typeTuple);
1231-
else
1230+
if (OidIsValid(typeStruct->typelem))
12321231
return typeStruct->typelem;
1232+
else
1233+
return HeapTupleGetOid(typeTuple);
12331234
}
12341235

12351236
/*

0 commit comments

Comments
 (0)