aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/common')
-rw-r--r--src/backend/access/common/printtup.c36
-rw-r--r--src/backend/access/common/tupdesc.c30
2 files changed, 26 insertions, 40 deletions
diff --git a/src/backend/access/common/printtup.c b/src/backend/access/common/printtup.c
index 6fe0e9652c2..ccf3071b502 100644
--- a/src/backend/access/common/printtup.c
+++ b/src/backend/access/common/printtup.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.53 2000/05/30 04:24:27 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.54 2000/11/16 22:30:15 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -36,7 +36,7 @@ static void printtup_cleanup(DestReceiver *self);
* getTypeOutAndElem -- get both typoutput and typelem for a type
*
* We used to fetch these with two separate function calls,
- * typtoout() and gettypelem(), which each called SearchSysCacheTuple.
+ * typtoout() and gettypelem(), which each called SearchSysCache.
* This way takes half the time.
* ----------------
*/
@@ -44,25 +44,19 @@ int
getTypeOutAndElem(Oid type, Oid *typOutput, Oid *typElem)
{
HeapTuple typeTuple;
-
- typeTuple = SearchSysCacheTuple(TYPEOID,
- ObjectIdGetDatum(type),
- 0, 0, 0);
-
- if (HeapTupleIsValid(typeTuple))
- {
- Form_pg_type pt = (Form_pg_type) GETSTRUCT(typeTuple);
-
- *typOutput = (Oid) pt->typoutput;
- *typElem = (Oid) pt->typelem;
- return OidIsValid(*typOutput);
- }
-
- elog(ERROR, "getTypeOutAndElem: Cache lookup of type %u failed", type);
-
- *typOutput = InvalidOid;
- *typElem = InvalidOid;
- return 0;
+ Form_pg_type pt;
+
+ typeTuple = SearchSysCache(TYPEOID,
+ ObjectIdGetDatum(type),
+ 0, 0, 0);
+ if (!HeapTupleIsValid(typeTuple))
+ elog(ERROR, "getTypeOutAndElem: Cache lookup of type %u failed", type);
+ pt = (Form_pg_type) GETSTRUCT(typeTuple);
+
+ *typOutput = pt->typoutput;
+ *typElem = pt->typelem;
+ ReleaseSysCache(typeTuple);
+ return OidIsValid(*typOutput);
}
/* ----------------
diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c
index 1ed2366efda..8b9b7cd537f 100644
--- a/src/backend/access/common/tupdesc.c
+++ b/src/backend/access/common/tupdesc.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.68 2000/11/08 22:09:53 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.69 2000/11/16 22:30:15 tgl Exp $
*
* NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be
@@ -401,9 +401,9 @@ TupleDescInitEntry(TupleDesc desc,
* -cim 6/14/90
* ----------------
*/
- tuple = SearchSysCacheTuple(TYPEOID,
- ObjectIdGetDatum(oidtypeid),
- 0, 0, 0);
+ tuple = SearchSysCache(TYPEOID,
+ ObjectIdGetDatum(oidtypeid),
+ 0, 0, 0);
if (!HeapTupleIsValid(tuple))
{
/* ----------------
@@ -455,25 +455,18 @@ TupleDescInitEntry(TupleDesc desc,
*/
if (attisset)
{
- Type t = typeidType(OIDOID);
-
- att->attlen = typeLen(t);
- att->attbyval = typeByVal(t);
+ att->attlen = sizeof(Oid);
+ att->attbyval = true;
+ att->attstorage = 'p';
}
else
{
att->attlen = typeForm->typlen;
att->attbyval = typeForm->typbyval;
-/*
- * Default to the types storage
- */
-#ifdef TUPLE_TOASTER_ACTIVE
att->attstorage = typeForm->typstorage;
-#else
- att->attstorage = 'p';
-#endif
}
+ ReleaseSysCache(tuple);
return true;
}
@@ -496,12 +489,11 @@ TupleDescMakeSelfReference(TupleDesc desc,
char *relname)
{
Form_pg_attribute att;
- Type t = typeidType(OIDOID);
att = desc->attrs[attnum - 1];
att->atttypid = TypeShellMake(relname);
- att->attlen = typeLen(t);
- att->attbyval = typeByVal(t);
+ att->attlen = sizeof(Oid);
+ att->attbyval = true;
att->attstorage = 'p';
att->attnelems = 0;
}
@@ -580,7 +572,7 @@ BuildDescForRelation(List *schema, char *relname)
}
if (!TupleDescInitEntry(desc, attnum, attname,
- typeTypeId(typenameType(typename)),
+ typenameTypeId(typename),
atttypmod, attdim, attisset))
{
/* ----------------