diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-11-16 22:30:52 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-11-16 22:30:52 +0000 |
commit | a933ee38bbb8dffbc48a3363a94ff6f2a9f7964d (patch) | |
tree | 1c32737389b2530e7152dc2287161b36d9001e8c /src/backend/access/common/tupdesc.c | |
parent | cff23842a4c68301ddf34559c7af383bb5557054 (diff) | |
download | postgresql-a933ee38bbb8dffbc48a3363a94ff6f2a9f7964d.tar.gz postgresql-a933ee38bbb8dffbc48a3363a94ff6f2a9f7964d.zip |
Change SearchSysCache coding conventions so that a reference count is
maintained for each cache entry. A cache entry will not be freed until
the matching ReleaseSysCache call has been executed. This eliminates
worries about cache entries getting dropped while still in use. See
my posting to pg-hackers of even date for more info.
Diffstat (limited to 'src/backend/access/common/tupdesc.c')
-rw-r--r-- | src/backend/access/common/tupdesc.c | 30 |
1 files changed, 11 insertions, 19 deletions
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)) { /* ---------------- |