1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

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 ...
This commit is contained in:
Tom Lane
2002-08-22 00:01:51 +00:00
parent 606c9b9d4f
commit b663f3443b
126 changed files with 2005 additions and 1205 deletions

View File

@ -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 ---------- */