diff --git a/doc/src/sgml/ref/create_type.sgml b/doc/src/sgml/ref/create_type.sgml index 4d05fa98cd195646e182864d541038548741695e..5fca3582fb72cbeb301a4571d4b786ca9b3d1e8d 100644 --- a/doc/src/sgml/ref/create_type.sgml +++ b/doc/src/sgml/ref/create_type.sgml @@ -1,5 +1,5 @@ @@ -103,8 +103,8 @@ CREATE TYPE name ( or as taking three arguments of types cstring, oid, integer. 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 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. diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c index ea10f8c8cd3d36a6129623ebd70d02523f328e11..6b1646b896dcad285740e2b6e7196508a17ceae9 100644 --- a/src/backend/utils/cache/lsyscache.c +++ b/src/backend/utils/cache/lsyscache.c @@ -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); } /*