diff options
Diffstat (limited to 'src/backend/utils/cache/lsyscache.c')
-rw-r--r-- | src/backend/utils/cache/lsyscache.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c index 9dc2bbd524b..2e3848947c8 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.116 2004/08/29 05:06:50 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/cache/lsyscache.c,v 1.117 2004/10/20 16:04:49 tgl Exp $ * * NOTES * Eventually, the index information should go through here, too. @@ -1548,6 +1548,42 @@ get_typtype(Oid typid) } /* + * get_type_func_class + * + * Given the type OID, obtain its TYPEFUNC classification. + * + * This is intended to centralize a bunch of formerly ad-hoc code for + * classifying types. The categories used here are useful for deciding + * how to handle functions returning the datatype. + */ +TypeFuncClass +get_type_func_class(Oid typid) +{ + switch (get_typtype(typid)) + { + case 'c': + return TYPEFUNC_COMPOSITE; + case 'b': + case 'd': + return TYPEFUNC_SCALAR; + case 'p': + if (typid == RECORDOID) + return TYPEFUNC_RECORD; + /* + * We treat VOID and CSTRING as legitimate scalar datatypes, + * mostly for the convenience of the JDBC driver (which wants + * to be able to do "SELECT * FROM foo()" for all legitimately + * user-callable functions). + */ + if (typid == VOIDOID || typid == CSTRINGOID) + return TYPEFUNC_SCALAR; + return TYPEFUNC_OTHER; + } + /* shouldn't get here, probably */ + return TYPEFUNC_OTHER; +} + +/* * get_typ_typrelid * * Given the type OID, get the typrelid (InvalidOid if not a complex |