diff options
Diffstat (limited to 'src/backend/utils/cache/syscache.c')
-rw-r--r-- | src/backend/utils/cache/syscache.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c index ba9452b80e4..e8f602c2ec2 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.54 2000/06/17 04:56:33 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.55 2000/06/20 01:41:22 tgl Exp $ * * NOTES * These routines allow the parser/planner/executor to perform @@ -482,14 +482,20 @@ SearchSysCacheTuple(int cacheId,/* cache selection code */ cacheId); } - /* temp table name remapping */ - if (cacheId == RELNAME) + /* + * If someone tries to look up a relname, translate temp relation + * names to real names. Less obviously, apply the same translation + * to type names, so that the type tuple of a temp table will be found + * when sought. This is a kluge ... temp table substitution should be + * happening at a higher level ... + */ + if (cacheId == RELNAME || cacheId == TYPENAME) { char *nontemp_relname; - if ((nontemp_relname = - get_temp_rel_by_username(DatumGetPointer(key1))) != NULL) - key1 = PointerGetDatum(nontemp_relname); + nontemp_relname = get_temp_rel_by_username(DatumGetCString(key1)); + if (nontemp_relname != NULL) + key1 = CStringGetDatum(nontemp_relname); } tp = SearchSysCache(SysCache[cacheId], key1, key2, key3, key4); |