diff options
Diffstat (limited to 'src/backend/utils/cache')
-rw-r--r-- | src/backend/utils/cache/lsyscache.c | 29 | ||||
-rw-r--r-- | src/backend/utils/cache/syscache.c | 12 | ||||
-rw-r--r-- | src/backend/utils/cache/temprel.c | 10 |
3 files changed, 36 insertions, 15 deletions
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c index 82be75ac799..6ec682f5206 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.66 2002/03/26 19:16:09 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.67 2002/03/29 19:06:15 tgl Exp $ * * NOTES * Eventually, the index information should go through here, too. @@ -739,6 +739,33 @@ get_rel_type_id(Oid relid) /* ---------- TYPE CACHE ---------- */ /* + * get_typisdefined + * + * Given the type OID, determine whether the type is defined + * (if not, it's only a shell). + */ +bool +get_typisdefined(Oid typid) +{ + HeapTuple tp; + + tp = SearchSysCache(TYPEOID, + ObjectIdGetDatum(typid), + 0, 0, 0); + if (HeapTupleIsValid(tp)) + { + Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp); + bool result; + + result = typtup->typisdefined; + ReleaseSysCache(tp); + return result; + } + else + return false; +} + +/* * get_typlen * * Given the type OID, return the length of the type. diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c index 57d4719b294..a160e4fb1bd 100644 --- a/src/backend/utils/cache/syscache.c +++ b/src/backend/utils/cache/syscache.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.70 2002/03/26 19:16:14 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.71 2002/03/29 19:06:15 tgl Exp $ * * NOTES * These routines allow the parser/planner/executor to perform @@ -384,13 +384,13 @@ static const struct cachedesc cacheinfo[] = { 0, 0 }}, - {TypeRelationName, /* TYPENAME */ - TypeNameIndex, + {TypeRelationName, /* TYPENAMENSP */ + TypeNameNspIndex, Anum_pg_type_typrelid, - 1, + 2, { Anum_pg_type_typname, - 0, + Anum_pg_type_typnamespace, 0, 0 }}, @@ -515,7 +515,7 @@ SearchSysCache(int cacheId, * when sought. This is a kluge ... temp table substitution should be * happening at a higher level ... */ - if (cacheId == RELNAMENSP || cacheId == TYPENAME) + if (cacheId == RELNAMENSP || cacheId == TYPENAMENSP) { char *nontemp_relname; diff --git a/src/backend/utils/cache/temprel.c b/src/backend/utils/cache/temprel.c index 88dc606cb0e..7ab609eaf36 100644 --- a/src/backend/utils/cache/temprel.c +++ b/src/backend/utils/cache/temprel.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/temprel.c,v 1.35 2001/03/22 03:59:58 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/temprel.c,v 1.36 2002/03/29 19:06:16 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -227,13 +227,7 @@ remove_all_temp_relations(void) continue; /* ignore it if deleted already */ if (temp_rel->relkind != RELKIND_INDEX) - { - char relname[NAMEDATALEN]; - - /* safe from deallocation */ - strcpy(relname, NameStr(temp_rel->user_relname)); - heap_drop_with_catalog(relname, allowSystemTableMods); - } + heap_drop_with_catalog(temp_rel->relid, allowSystemTableMods); else index_drop(temp_rel->relid); /* advance cmd counter to make catalog changes visible */ |