On Sat, Mar 31, 2007 at 07:58:34PM -0400, Tom Lane wrote:
> David Fetter <[EMAIL PROTECTED]> writes:
> > What say we put one in pre-emptively for TYPTYPE_ARRAY?
> 
> When and if the patch appears, you can add it ;-).  I'm just intending a
> search-and-replace at the moment.

Like this?

Cheers,
D
-- 
David Fetter <[EMAIL PROTECTED]> http://fetter.org/
phone: +1 415 235 3778        AIM: dfetter666
                              Skype: davidfetter

Remember to vote!
Consider donating to PostgreSQL: http://www.postgresql.org/about/donate
Index: src/backend/catalog/heap.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/catalog/heap.c,v
retrieving revision 1.317
diff -c -r1.317 heap.c
*** src/backend/catalog/heap.c  14 Feb 2007 01:58:56 -0000      1.317
--- src/backend/catalog/heap.c  1 Apr 2007 00:17:20 -0000
***************
*** 412,418 ****
                                (errcode(ERRCODE_INVALID_TABLE_DEFINITION),
                                 errmsg("column \"%s\" has type \"unknown\"", 
attname),
                                 errdetail("Proceeding with relation creation 
anyway.")));
!       else if (att_typtype == 'p')
        {
                /* Special hack for pg_statistic: allow ANYARRAY during initdb 
*/
                if (atttypid != ANYARRAYOID || IsUnderPostmaster)
--- 412,418 ----
                                (errcode(ERRCODE_INVALID_TABLE_DEFINITION),
                                 errmsg("column \"%s\" has type \"unknown\"", 
attname),
                                 errdetail("Proceeding with relation creation 
anyway.")));
!       else if (att_typtype == TYPTYPE_PSEUDO)
        {
                /* Special hack for pg_statistic: allow ANYARRAY during initdb 
*/
                if (atttypid != ANYARRAYOID || IsUnderPostmaster)
Index: src/backend/commands/typecmds.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/commands/typecmds.c,v
retrieving revision 1.100
diff -c -r1.100 typecmds.c
*** src/backend/commands/typecmds.c     14 Feb 2007 01:58:57 -0000      1.100
--- src/backend/commands/typecmds.c     1 Apr 2007 00:17:20 -0000
***************
*** 625,631 ****
         * might be made to work in the future, but not today.
         */
        typtype = baseType->typtype;
!       if (typtype != 'b' && typtype != 'd')
                ereport(ERROR,
                                (errcode(ERRCODE_DATATYPE_MISMATCH),
                                 errmsg("\"%s\" is not a valid base type for a 
domain",
--- 625,631 ----
         * might be made to work in the future, but not today.
         */
        typtype = baseType->typtype;
!       if (typtype != TYPTYPE_BASE && typtype != TYPTYPE_DOMAIN)
                ereport(ERROR,
                                (errcode(ERRCODE_DATATYPE_MISMATCH),
                                 errmsg("\"%s\" is not a valid base type for a 
domain",
***************
*** 907,913 ****
        /* Check that this is actually a domain */
        typtype = ((Form_pg_type) GETSTRUCT(tup))->typtype;
  
!       if (typtype != 'd')
                ereport(ERROR,
                                (errcode(ERRCODE_WRONG_OBJECT_TYPE),
                                 errmsg("\"%s\" is not a domain",
--- 907,913 ----
        /* Check that this is actually a domain */
        typtype = ((Form_pg_type) GETSTRUCT(tup))->typtype;
  
!       if (typtype != TYPTYPE_DOMAIN)
                ereport(ERROR,
                                (errcode(ERRCODE_WRONG_OBJECT_TYPE),
                                 errmsg("\"%s\" is not a domain",
***************
*** 1835,1841 ****
        Form_pg_type typTup = (Form_pg_type) GETSTRUCT(tup);
  
        /* Check that this is actually a domain */
!       if (typTup->typtype != 'd')
                ereport(ERROR,
                                (errcode(ERRCODE_WRONG_OBJECT_TYPE),
                                 errmsg("\"%s\" is not a domain",
--- 1835,1841 ----
        Form_pg_type typTup = (Form_pg_type) GETSTRUCT(tup);
  
        /* Check that this is actually a domain */
!       if (typTup->typtype != TYPTYPE_DOMAIN)
                ereport(ERROR,
                                (errcode(ERRCODE_WRONG_OBJECT_TYPE),
                                 errmsg("\"%s\" is not a domain",
***************
*** 2021,2027 ****
                        elog(ERROR, "cache lookup failed for type %u", typeOid);
                typTup = (Form_pg_type) GETSTRUCT(tup);
  
!               if (typTup->typtype != 'd')
                {
                        /* Not a domain, so done */
                        ReleaseSysCache(tup);
--- 2021,2027 ----
                        elog(ERROR, "cache lookup failed for type %u", typeOid);
                typTup = (Form_pg_type) GETSTRUCT(tup);
  
!               if (typTup->typtype != TYPTYPE_DOMAIN)
                {
                        /* Not a domain, so done */
                        ReleaseSysCache(tup);
***************
*** 2148,2154 ****
         * free-standing composite type, and not a table's underlying type. We
         * want people to use ALTER TABLE not ALTER TYPE for that case.
         */
!       if (typTup->typtype == 'c' &&
                get_rel_relkind(typTup->typrelid) != RELKIND_COMPOSITE_TYPE)
                ereport(ERROR,
                                (errcode(ERRCODE_WRONG_OBJECT_TYPE),
--- 2148,2154 ----
         * free-standing composite type, and not a table's underlying type. We
         * want people to use ALTER TABLE not ALTER TYPE for that case.
         */
!       if (typTup->typtype == TYPTYPE_COMPOUND &&
                get_rel_relkind(typTup->typrelid) != RELKIND_COMPOSITE_TYPE)
                ereport(ERROR,
                                (errcode(ERRCODE_WRONG_OBJECT_TYPE),
***************
*** 2325,2335 ****
  
        /* Detect whether type is a composite type (but not a table rowtype) */
        isCompositeType =
!               (typform->typtype == 'c' &&
                 get_rel_relkind(typform->typrelid) == RELKIND_COMPOSITE_TYPE);
  
        /* Enforce not-table-type if requested */
!       if (typform->typtype == 'c' && !isCompositeType && errorOnTableType)
                ereport(ERROR,
                                (errcode(ERRCODE_WRONG_OBJECT_TYPE),
                                 errmsg("%s is a table's row type",
--- 2325,2335 ----
  
        /* Detect whether type is a composite type (but not a table rowtype) */
        isCompositeType =
!               (typform->typtype == TYPTYPE_COMPOUND &&
                 get_rel_relkind(typform->typrelid) == RELKIND_COMPOSITE_TYPE);
  
        /* Enforce not-table-type if requested */
!       if (typform->typtype == TYPTYPE_COMPOUND && !isCompositeType && 
errorOnTableType)
                ereport(ERROR,
                                (errcode(ERRCODE_WRONG_OBJECT_TYPE),
                                 errmsg("%s is a table's row type",
***************
*** 2376,2389 ****
        else
        {
                /* If it's a domain, it might have constraints */
!               if (typform->typtype == 'd')
                        AlterConstraintNamespaces(typeOid, oldNspOid, nspOid, 
true);
  
                /*
                 * Update dependency on schema, if any --- a table rowtype has 
not got
                 * one.
                 */
!               if (typform->typtype != 'c')
                        if (changeDependencyFor(TypeRelationId, typeOid,
                                                                
NamespaceRelationId, oldNspOid, nspOid) != 1)
                                elog(ERROR, "failed to change schema dependency 
for type %s",
--- 2376,2389 ----
        else
        {
                /* If it's a domain, it might have constraints */
!               if (typform->typtype == TYPTYPE_DOMAIN)
                        AlterConstraintNamespaces(typeOid, oldNspOid, nspOid, 
true);
  
                /*
                 * Update dependency on schema, if any --- a table rowtype has 
not got
                 * one.
                 */
!               if (typform->typtype != TYPTYPE_COMPOUND)
                        if (changeDependencyFor(TypeRelationId, typeOid,
                                                                
NamespaceRelationId, oldNspOid, nspOid) != 1)
                                elog(ERROR, "failed to change schema dependency 
for type %s",
Index: src/backend/executor/functions.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/executor/functions.c,v
retrieving revision 1.112
diff -c -r1.112 functions.c
*** src/backend/executor/functions.c    13 Mar 2007 00:33:40 -0000      1.112
--- src/backend/executor/functions.c    1 Apr 2007 00:17:21 -0000
***************
*** 925,931 ****
  
        fn_typtype = get_typtype(rettype);
  
!       if (fn_typtype == 'b' || fn_typtype == 'd')
        {
                /*
                 * For base-type returns, the target list should have exactly 
one
--- 925,931 ----
  
        fn_typtype = get_typtype(rettype);
  
!       if (fn_typtype == TYPTYPE_BASE || fn_typtype == TYPTYPE_DOMAIN)
        {
                /*
                 * For base-type returns, the target list should have exactly 
one
***************
*** 948,954 ****
                                         errdetail("Actual return type is %s.",
                                                           
format_type_be(restype))));
        }
!       else if (fn_typtype == 'c' || rettype == RECORDOID)
        {
                /* Returns a rowtype */
                TupleDesc       tupdesc;
--- 948,954 ----
                                         errdetail("Actual return type is %s.",
                                                           
format_type_be(restype))));
        }
!       else if (fn_typtype == TYPTYPE_COMPOUND || rettype == RECORDOID)
        {
                /* Returns a rowtype */
                TupleDesc       tupdesc;
Index: src/backend/parser/parse_coerce.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/parser/parse_coerce.c,v
retrieving revision 2.152
diff -c -r2.152 parse_coerce.c
*** src/backend/parser/parse_coerce.c   27 Mar 2007 23:21:10 -0000      2.152
--- src/backend/parser/parse_coerce.c   1 Apr 2007 00:17:21 -0000
***************
*** 1813,1819 ****
        /* Check for a varlena array type (and not a domain) */
        if (typeForm->typelem != InvalidOid &&
                typeForm->typlen == -1 &&
!               typeForm->typtype != 'd')
        {
                /* Yes, switch our attention to the element type */
                typeId = typeForm->typelem;
--- 1813,1819 ----
        /* Check for a varlena array type (and not a domain) */
        if (typeForm->typelem != InvalidOid &&
                typeForm->typlen == -1 &&
!               typeForm->typtype != TYPTYPE_DOMAIN)
        {
                /* Yes, switch our attention to the element type */
                typeId = typeForm->typelem;
Index: src/backend/utils/adt/format_type.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/format_type.c,v
retrieving revision 1.46
diff -c -r1.46 format_type.c
*** src/backend/utils/adt/format_type.c 5 Jan 2007 22:19:40 -0000       1.46
--- src/backend/utils/adt/format_type.c 1 Apr 2007 00:17:21 -0000
***************
*** 148,154 ****
  
        if (array_base_type != InvalidOid &&
                typeform->typstorage != 'p' &&
!               typeform->typtype != 'd')
        {
                /* Switch our attention to the array element type */
                ReleaseSysCache(tuple);
--- 148,154 ----
  
        if (array_base_type != InvalidOid &&
                typeform->typstorage != 'p' &&
!               typeform->typtype != TYPTYPE_DOMAIN)
        {
                /* Switch our attention to the array element type */
                ReleaseSysCache(tuple);
Index: src/backend/utils/adt/xml.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/xml.c,v
retrieving revision 1.37
diff -c -r1.37 xml.c
*** src/backend/utils/adt/xml.c 22 Mar 2007 20:26:30 -0000      1.37
--- src/backend/utils/adt/xml.c 1 Apr 2007 00:17:22 -0000
***************
*** 2103,2109 ****
                        Form_pg_type typtuple = (Form_pg_type) GETSTRUCT(tuple);
  
                        appendStringInfoString(&result,
!                                                                  
map_multipart_sql_identifier_to_xml_name((typtuple->typtype == 'd') ? "Domain" 
: "UDT",
                                                                                
                                                                        
get_database_name(MyDatabaseId),
                                                                                
                                                                        
get_namespace_name(typtuple->typnamespace),
                                                                                
                                                                        
NameStr(typtuple->typname)));
--- 2103,2109 ----
                        Form_pg_type typtuple = (Form_pg_type) GETSTRUCT(tuple);
  
                        appendStringInfoString(&result,
!                                                                  
map_multipart_sql_identifier_to_xml_name((typtuple->typtype == TYPTYPE_DOMAIN) 
? "Domain" : "UDT",
                                                                                
                                                                        
get_database_name(MyDatabaseId),
                                                                                
                                                                        
get_namespace_name(typtuple->typnamespace),
                                                                                
                                                                        
NameStr(typtuple->typname)));
Index: src/backend/utils/cache/lsyscache.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v
retrieving revision 1.150
diff -c -r1.150 lsyscache.c
*** src/backend/utils/cache/lsyscache.c 19 Mar 2007 16:30:31 -0000      1.150
--- src/backend/utils/cache/lsyscache.c 1 Apr 2007 00:17:22 -0000
***************
*** 1770,1776 ****
         * own type OID as parameter.  (As of 8.2, domains must get their own 
OID
         * even if their base type is an array.)
         */
!       if (typeStruct->typtype == 'b' && OidIsValid(typeStruct->typelem))
                return typeStruct->typelem;
        else
                return HeapTupleGetOid(typeTuple);
--- 1770,1776 ----
         * own type OID as parameter.  (As of 8.2, domains must get their own 
OID
         * even if their base type is an array.)
         */
!       if (typeStruct->typtype == TYPTYPE_BASE && 
OidIsValid(typeStruct->typelem))
                return typeStruct->typelem;
        else
                return HeapTupleGetOid(typeTuple);
***************
*** 2022,2028 ****
                if (!HeapTupleIsValid(tup))
                        elog(ERROR, "cache lookup failed for type %u", typid);
                typTup = (Form_pg_type) GETSTRUCT(tup);
!               if (typTup->typtype != 'd')
                {
                        /* Not a domain, so done */
                        ReleaseSysCache(tup);
--- 2022,2028 ----
                if (!HeapTupleIsValid(tup))
                        elog(ERROR, "cache lookup failed for type %u", typid);
                typTup = (Form_pg_type) GETSTRUCT(tup);
!               if (typTup->typtype != TYPTYPE_DOMAIN)
                {
                        /* Not a domain, so done */
                        ReleaseSysCache(tup);
Index: src/backend/utils/cache/typcache.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/cache/typcache.c,v
retrieving revision 1.24
diff -c -r1.24 typcache.c
*** src/backend/utils/cache/typcache.c  5 Jan 2007 22:19:43 -0000       1.24
--- src/backend/utils/cache/typcache.c  1 Apr 2007 00:17:22 -0000
***************
*** 275,281 ****
         */
        if ((flags & TYPECACHE_TUPDESC) &&
                typentry->tupDesc == NULL &&
!               typentry->typtype == 'c')
        {
                Relation        rel;
  
--- 275,281 ----
         */
        if ((flags & TYPECACHE_TUPDESC) &&
                typentry->tupDesc == NULL &&
!               typentry->typtype == TYPTYPE_COMPOUND)
        {
                Relation        rel;
  
Index: src/bin/pg_dump/pg_dump.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v
retrieving revision 1.465
diff -c -r1.465 pg_dump.c
*** src/bin/pg_dump/pg_dump.c   26 Mar 2007 16:58:39 -0000      1.465
--- src/bin/pg_dump/pg_dump.c   1 Apr 2007 00:17:23 -0000
***************
*** 2085,2091 ****
                 */
                tinfo[i].nDomChecks = 0;
                tinfo[i].domChecks = NULL;
!               if (tinfo[i].dobj.dump && tinfo[i].typtype == 'd')
                        getDomainConstraints(&(tinfo[i]));
  
                /*
--- 2085,2091 ----
                 */
                tinfo[i].nDomChecks = 0;
                tinfo[i].domChecks = NULL;
!               if (tinfo[i].dobj.dump && tinfo[i].typtype == TYPTYPE_DOMAIN)
                        getDomainConstraints(&(tinfo[i]));
  
                /*
***************
*** 2097,2103 ****
                 * should copy the base type's catId, but then it might capture 
the
                 * pg_depend entries for the type, which we don't want.
                 */
!               if (tinfo[i].dobj.dump && tinfo[i].typtype == 'b')
                {
                        stinfo = (ShellTypeInfo *) 
malloc(sizeof(ShellTypeInfo));
                        stinfo->dobj.objType = DO_SHELL_TYPE;
--- 2097,2103 ----
                 * should copy the base type's catId, but then it might capture 
the
                 * pg_depend entries for the type, which we don't want.
                 */
!               if (tinfo[i].dobj.dump && tinfo[i].typtype == TYPTYPE_BASE)
                {
                        stinfo = (ShellTypeInfo *) 
malloc(sizeof(ShellTypeInfo));
                        stinfo->dobj.objType = DO_SHELL_TYPE;
***************
*** 5119,5129 ****
                return;
  
        /* Dump out in proper style */
!       if (tinfo->typtype == 'b')
                dumpBaseType(fout, tinfo);
!       else if (tinfo->typtype == 'd')
                dumpDomain(fout, tinfo);
!       else if (tinfo->typtype == 'c')
                dumpCompositeType(fout, tinfo);
  }
  
--- 5119,5129 ----
                return;
  
        /* Dump out in proper style */
!       if (tinfo->typtype == TYPTYPE_BASE)
                dumpBaseType(fout, tinfo);
!       else if (tinfo->typtype == TYPTYPE_DOMAIN)
                dumpDomain(fout, tinfo);
!       else if (tinfo->typtype == TYPTYPE_COMPOUND)
                dumpCompositeType(fout, tinfo);
  }
  
Index: src/include/catalog/pg_type.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/catalog/pg_type.h,v
retrieving revision 1.180
diff -c -r1.180 pg_type.h
*** src/include/catalog/pg_type.h       28 Jan 2007 16:16:54 -0000      1.180
--- src/include/catalog/pg_type.h       1 Apr 2007 00:17:24 -0000
***************
*** 566,571 ****
--- 566,578 ----
  DESCR("UUID datatype");
  DATA(insert OID = 2951 ( _uuid                        PGNSP PGUID -1 f b t 
\054 0 2950 array_in array_out array_recv array_send - - - i x f 0 -1 0 _null_ 
_null_ ));
  
+ #define               TYPTYPE_ARRAY           'a'             /* Generic 
array */
+ #define               TYPTYPE_BASE            'b'             /* Base type */
+ #define               TYPTYPE_COMPOUND        'c'             /* Compound 
type */
+ #define               TYPTYPE_DOMAIN          'd'             /* Domain */
+ #define               TYPTYPE_ENUM            'e'             /* Enum */
+ #define               TYPTYPE_PSEUDO          'p'             /* Pseudo (as 
in ROW and RECORD) */
+ 
  /*
   * prototypes for functions in pg_type.c
   */
Index: src/pl/plperl/plperl.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/pl/plperl/plperl.c,v
retrieving revision 1.127
diff -c -r1.127 plperl.c
*** src/pl/plperl/plperl.c      9 Feb 2007 03:35:34 -0000       1.127
--- src/pl/plperl/plperl.c      1 Apr 2007 00:17:24 -0000
***************
*** 843,849 ****
  
        /* Disallow pseudotype result */
        /* except for TRIGGER, RECORD, or VOID */
!       if (functyptype == 'p')
        {
                /* we assume OPAQUE with no arguments means a trigger */
                if (proc->prorettype == TRIGGEROID ||
--- 843,849 ----
  
        /* Disallow pseudotype result */
        /* except for TRIGGER, RECORD, or VOID */
!       if (functyptype == TYPTYPE_PSEUDO)
        {
                /* we assume OPAQUE with no arguments means a trigger */
                if (proc->prorettype == TRIGGEROID ||
***************
*** 1525,1531 ****
                        typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
  
                        /* Disallow pseudotype result, except VOID or RECORD */
!                       if (typeStruct->typtype == 'p')
                        {
                                if (procStruct->prorettype == VOIDOID ||
                                        procStruct->prorettype == RECORDOID)
--- 1525,1531 ----
                        typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
  
                        /* Disallow pseudotype result, except VOID or RECORD */
!                       if (typeStruct->typtype == TYPTYPE_PSEUDO)
                        {
                                if (procStruct->prorettype == VOIDOID ||
                                        procStruct->prorettype == RECORDOID)
***************
*** 1552,1558 ****
  
                        prodesc->result_oid = procStruct->prorettype;
                        prodesc->fn_retisset = procStruct->proretset;
!                       prodesc->fn_retistuple = (typeStruct->typtype == 'c' ||
                                                                          
procStruct->prorettype == RECORDOID);
  
                        prodesc->fn_retisarray =
--- 1552,1558 ----
  
                        prodesc->result_oid = procStruct->prorettype;
                        prodesc->fn_retisset = procStruct->proretset;
!                       prodesc->fn_retistuple = (typeStruct->typtype == 
TYPTYPE_COMPOUND ||
                                                                          
procStruct->prorettype == RECORDOID);
  
                        prodesc->fn_retisarray =
***************
*** 1586,1592 ****
                                typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
  
                                /* Disallow pseudotype argument */
!                               if (typeStruct->typtype == 'p')
                                {
                                        free(prodesc->proname);
                                        free(prodesc);
--- 1586,1592 ----
                                typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
  
                                /* Disallow pseudotype argument */
!                               if (typeStruct->typtype == TYPTYPE_PSEUDO)
                                {
                                        free(prodesc->proname);
                                        free(prodesc);
***************
*** 1596,1602 ****
                                                
format_type_be(procStruct->proargtypes.values[i]))));
                                }
  
!                               if (typeStruct->typtype == 'c')
                                        prodesc->arg_is_rowtype[i] = true;
                                else
                                {
--- 1596,1602 ----
                                                
format_type_be(procStruct->proargtypes.values[i]))));
                                }
  
!                               if (typeStruct->typtype == TYPTYPE_COMPOUND)
                                        prodesc->arg_is_rowtype[i] = true;
                                else
                                {
Index: src/pl/plpgsql/src/pl_comp.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v
retrieving revision 1.113
diff -c -r1.113 pl_comp.c
*** src/pl/plpgsql/src/pl_comp.c        9 Feb 2007 03:35:34 -0000       1.113
--- src/pl/plpgsql/src/pl_comp.c        1 Apr 2007 00:17:24 -0000
***************
*** 513,519 ****
  
                        /* Disallow pseudotype result, except VOID or RECORD */
                        /* (note we already replaced ANYARRAY/ANYELEMENT) */
!                       if (typeStruct->typtype == 'p')
                        {
                                if (rettypeid == VOIDOID ||
                                        rettypeid == RECORDOID)
--- 513,519 ----
  
                        /* Disallow pseudotype result, except VOID or RECORD */
                        /* (note we already replaced ANYARRAY/ANYELEMENT) */
!                       if (typeStruct->typtype == TYPTYPE_PSEUDO)
                        {
                                if (rettypeid == VOIDOID ||
                                        rettypeid == RECORDOID)
Index: src/pl/plpgsql/src/pl_handler.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/pl/plpgsql/src/pl_handler.c,v
retrieving revision 1.36
diff -c -r1.36 pl_handler.c
*** src/pl/plpgsql/src/pl_handler.c     30 Jan 2007 22:05:13 -0000      1.36
--- src/pl/plpgsql/src/pl_handler.c     1 Apr 2007 00:17:24 -0000
***************
*** 148,154 ****
  
        /* Disallow pseudotype result */
        /* except for TRIGGER, RECORD, VOID, ANYARRAY, or ANYELEMENT */
!       if (functyptype == 'p')
        {
                /* we assume OPAQUE with no arguments means a trigger */
                if (proc->prorettype == TRIGGEROID ||
--- 148,154 ----
  
        /* Disallow pseudotype result */
        /* except for TRIGGER, RECORD, VOID, ANYARRAY, or ANYELEMENT */
!       if (functyptype == TYPTYPE_PSEUDO)
        {
                /* we assume OPAQUE with no arguments means a trigger */
                if (proc->prorettype == TRIGGEROID ||
Index: src/pl/plpython/plpython.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/pl/plpython/plpython.c,v
retrieving revision 1.96
diff -c -r1.96 plpython.c
*** src/pl/plpython/plpython.c  21 Feb 2007 03:27:32 -0000      1.96
--- src/pl/plpython/plpython.c  1 Apr 2007 00:17:25 -0000
***************
*** 1185,1191 ****
                        rvTypeStruct = (Form_pg_type) GETSTRUCT(rvTypeTup);
  
                        /* Disallow pseudotype result, except for void */
!                       if (rvTypeStruct->typtype == 'p' &&
                                procStruct->prorettype != VOIDOID)
                        {
                                if (procStruct->prorettype == TRIGGEROID)
--- 1185,1191 ----
                        rvTypeStruct = (Form_pg_type) GETSTRUCT(rvTypeTup);
  
                        /* Disallow pseudotype result, except for void */
!                       if (rvTypeStruct->typtype == TYPTYPE_PSEUDO &&
                                procStruct->prorettype != VOIDOID)
                        {
                                if (procStruct->prorettype == TRIGGEROID)
***************
*** 1199,1205 ****
                                                                  
format_type_be(procStruct->prorettype))));
                        }
  
!                       if (rvTypeStruct->typtype == 'c')
                        {
                                /*
                                 * Tuple: set up later, during first call to
--- 1199,1205 ----
                                                                  
format_type_be(procStruct->prorettype))));
                        }
  
!                       if (rvTypeStruct->typtype == TYPTYPE_COMPOUND)
                        {
                                /*
                                 * Tuple: set up later, during first call to
***************
*** 1258,1270 ****
                        argTypeStruct = (Form_pg_type) GETSTRUCT(argTypeTup);
  
                        /* Disallow pseudotype argument */
!                       if (argTypeStruct->typtype == 'p')
                                ereport(ERROR,
                                                
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                                                 errmsg("plpython functions 
cannot take type %s",
                                                
format_type_be(procStruct->proargtypes.values[i]))));
  
!                       if (argTypeStruct->typtype != 'c')
                                PLy_input_datum_func(&(proc->args[i]),
                                                                         
procStruct->proargtypes.values[i],
                                                                         
argTypeTup);
--- 1258,1270 ----
                        argTypeStruct = (Form_pg_type) GETSTRUCT(argTypeTup);
  
                        /* Disallow pseudotype argument */
!                       if (argTypeStruct->typtype == TYPTYPE_PSEUDO)
                                ereport(ERROR,
                                                
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                                                 errmsg("plpython functions 
cannot take type %s",
                                                
format_type_be(procStruct->proargtypes.values[i]))));
  
!                       if (argTypeStruct->typtype != TYPTYPE_COMPOUND)
                                PLy_input_datum_func(&(proc->args[i]),
                                                                         
procStruct->proargtypes.values[i],
                                                                         
argTypeTup);
***************
*** 2338,2344 ****
  
                                        plan->types[i] = typeId;
                                        typeStruct = (Form_pg_type) 
GETSTRUCT(typeTup);
!                                       if (typeStruct->typtype != 'c')
                                                
PLy_output_datum_func(&plan->args[i], typeTup);
                                        else
                                                elog(ERROR, "tuples not handled 
in plpy.prepare, yet.");
--- 2338,2344 ----
  
                                        plan->types[i] = typeId;
                                        typeStruct = (Form_pg_type) 
GETSTRUCT(typeTup);
!                                       if (typeStruct->typtype != 
TYPTYPE_COMPOUND)
                                                
PLy_output_datum_func(&plan->args[i], typeTup);
                                        else
                                                elog(ERROR, "tuples not handled 
in plpy.prepare, yet.");
Index: src/pl/tcl/pltcl.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/pl/tcl/pltcl.c,v
retrieving revision 1.111
diff -c -r1.111 pltcl.c
*** src/pl/tcl/pltcl.c  21 Feb 2007 03:27:32 -0000      1.111
--- src/pl/tcl/pltcl.c  1 Apr 2007 00:17:25 -0000
***************
*** 1051,1057 ****
                        typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
  
                        /* Disallow pseudotype result, except VOID */
!                       if (typeStruct->typtype == 'p')
                        {
                                if (procStruct->prorettype == VOIDOID)
                                         /* okay */ ;
--- 1051,1057 ----
                        typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
  
                        /* Disallow pseudotype result, except VOID */
!                       if (typeStruct->typtype == TYPTYPE_PSEUDO)
                        {
                                if (procStruct->prorettype == VOIDOID)
                                         /* okay */ ;
***************
*** 1074,1080 ****
                                }
                        }
  
!                       if (typeStruct->typtype == 'c')
                        {
                                free(prodesc->proname);
                                free(prodesc);
--- 1074,1080 ----
                                }
                        }
  
!                       if (typeStruct->typtype == TYPTYPE_COMPOUND)
                        {
                                free(prodesc->proname);
                                free(prodesc);
***************
*** 1112,1118 ****
                                typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
  
                                /* Disallow pseudotype argument */
!                               if (typeStruct->typtype == 'p')
                                {
                                        free(prodesc->proname);
                                        free(prodesc);
--- 1112,1118 ----
                                typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
  
                                /* Disallow pseudotype argument */
!                               if (typeStruct->typtype == TYPTYPE_PSEUDO)
                                {
                                        free(prodesc->proname);
                                        free(prodesc);
***************
*** 1122,1128 ****
                                                
format_type_be(procStruct->proargtypes.values[i]))));
                                }
  
!                               if (typeStruct->typtype == 'c')
                                {
                                        prodesc->arg_is_rowtype[i] = true;
                                        snprintf(buf, sizeof(buf), 
"__PLTcl_Tup_%d", i + 1);
--- 1122,1128 ----
                                                
format_type_be(procStruct->proargtypes.values[i]))));
                                }
  
!                               if (typeStruct->typtype == TYPTYPE_COMPOUND)
                                {
                                        prodesc->arg_is_rowtype[i] = true;
                                        snprintf(buf, sizeof(buf), 
"__PLTcl_Tup_%d", i + 1);
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to