diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-08-22 00:01:51 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-08-22 00:01:51 +0000 |
commit | b663f3443ba096a06970214c3e83e79f6e570b84 (patch) | |
tree | 049e26c1b02535c12bee6e60ba89cf1d42a41a72 /src/backend/utils/cache | |
parent | 606c9b9d4fafe9300d039c044edc9727c0ed43c9 (diff) | |
download | postgresql-b663f3443ba096a06970214c3e83e79f6e570b84.tar.gz postgresql-b663f3443ba096a06970214c3e83e79f6e570b84.zip |
Add a bunch of pseudo-types to replace the behavior formerly associated
with OPAQUE, as per recent pghackers discussion. I still want to do some
more work on the 'cstring' pseudo-type, but I'm going to commit the bulk
of the changes now before the tree starts shifting under me ...
Diffstat (limited to 'src/backend/utils/cache')
-rw-r--r-- | src/backend/utils/cache/lsyscache.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c index 4c2838e7af7..a916dc94012 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 - * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.78 2002/08/05 02:30:50 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.79 2002/08/22 00:01:44 tgl Exp $ * * NOTES * Eventually, the index information should go through here, too. @@ -1166,6 +1166,34 @@ get_typtype(Oid typid) return '\0'; } +/* + * getTypeOutputInfo + * + * Get info needed for printing values of a type + * + * Returns true if data valid (a false result probably means it's a shell type) + */ +bool +getTypeOutputInfo(Oid type, Oid *typOutput, Oid *typElem, + bool *typIsVarlena) +{ + HeapTuple typeTuple; + Form_pg_type pt; + + typeTuple = SearchSysCache(TYPEOID, + ObjectIdGetDatum(type), + 0, 0, 0); + if (!HeapTupleIsValid(typeTuple)) + elog(ERROR, "getTypeOutputInfo: Cache lookup of type %u failed", type); + pt = (Form_pg_type) GETSTRUCT(typeTuple); + + *typOutput = pt->typoutput; + *typElem = pt->typelem; + *typIsVarlena = (!pt->typbyval) && (pt->typlen == -1); + ReleaseSysCache(typeTuple); + return OidIsValid(*typOutput); +} + /* ---------- STATISTICS CACHE ---------- */ |