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.
This commit is contained in:
parent
bb2ffe9acf
commit
59c016aa9f
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_type.sgml,v 1.57 2005/07/14 06:17:36 neilc Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_type.sgml,v 1.58 2005/08/12 21:49:46 tgl Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@ -103,8 +103,8 @@ CREATE TYPE <replaceable class="parameter">name</replaceable> (
|
||||
or as taking three arguments of types
|
||||
<type>cstring</type>, <type>oid</type>, <type>integer</type>.
|
||||
The first argument is the input text as a C string, the second
|
||||
argument is the element type's OID in case this is an array type
|
||||
(or the type's own OID for a composite type),
|
||||
argument is the type's own OID (except for array types, which instead
|
||||
receive their element type's OID),
|
||||
and the third is the <literal>typmod</> of the destination column, if known
|
||||
(-1 will be passed if not).
|
||||
The input function must return a value of the data type itself.
|
||||
|
13
src/backend/utils/cache/lsyscache.c
vendored
13
src/backend/utils/cache/lsyscache.c
vendored
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/cache/lsyscache.c,v 1.126 2005/06/28 05:09:01 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/cache/lsyscache.c,v 1.127 2005/08/12 21:49:47 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Eventually, the index information should go through here, too.
|
||||
@ -1223,13 +1223,14 @@ getTypeIOParam(HeapTuple typeTuple)
|
||||
Form_pg_type typeStruct = (Form_pg_type) GETSTRUCT(typeTuple);
|
||||
|
||||
/*
|
||||
* Composite types get their own OID as parameter; array types get
|
||||
* their typelem as parameter; everybody else gets zero.
|
||||
* Array types get their typelem as parameter; everybody else gets
|
||||
* their own type OID as parameter. (This is a change from 8.0,
|
||||
* in which only composite types got their own OID as parameter.)
|
||||
*/
|
||||
if (typeStruct->typtype == 'c')
|
||||
return HeapTupleGetOid(typeTuple);
|
||||
else
|
||||
if (OidIsValid(typeStruct->typelem))
|
||||
return typeStruct->typelem;
|
||||
else
|
||||
return HeapTupleGetOid(typeTuple);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user