diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-06-16 18:42:24 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-06-16 18:42:24 +0000 |
commit | 06e10abc0bb4297a0754313b4f158bdd5622ca24 (patch) | |
tree | 6d413dfdfab3fea4a6d96b07b7fdb8ba81498860 /src/include/utils/typcache.h | |
parent | b49ce32da1975b2fdab26e463b7189b95e770809 (diff) | |
download | postgresql-06e10abc0bb4297a0754313b4f158bdd5622ca24.tar.gz postgresql-06e10abc0bb4297a0754313b4f158bdd5622ca24.zip |
Fix problems with cached tuple descriptors disappearing while still in use
by creating a reference-count mechanism, similar to what we did a long time
ago for catcache entries. The back branches have an ugly solution involving
lots of extra copies, but this way is more efficient. Reference counting is
only applied to tupdescs that are actually in caches --- there seems no need
to use it for tupdescs that are generated in the executor, since they'll go
away during plan shutdown by virtue of being in the per-query memory context.
Neil Conway and Tom Lane
Diffstat (limited to 'src/include/utils/typcache.h')
-rw-r--r-- | src/include/utils/typcache.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/include/utils/typcache.h b/src/include/utils/typcache.h index cbb13be3255..7d3e284871c 100644 --- a/src/include/utils/typcache.h +++ b/src/include/utils/typcache.h @@ -9,7 +9,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/typcache.h,v 1.10 2006/03/05 15:59:08 momjian Exp $ + * $PostgreSQL: pgsql/src/include/utils/typcache.h,v 1.11 2006/06/16 18:42:23 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -58,7 +58,7 @@ typedef struct TypeCacheEntry /* * Tuple descriptor if it's a composite type (row type). NULL if not * composite or information hasn't yet been requested. (NOTE: this is - * actually just a link to information maintained by relcache.c.) + * a reference-counted tupledesc.) */ TupleDesc tupDesc; } TypeCacheEntry; @@ -79,6 +79,8 @@ extern TupleDesc lookup_rowtype_tupdesc(Oid type_id, int32 typmod); extern TupleDesc lookup_rowtype_tupdesc_noerror(Oid type_id, int32 typmod, bool noError); +extern TupleDesc lookup_rowtype_tupdesc_copy(Oid type_id, int32 typmod); + extern void assign_record_type_typmod(TupleDesc tupDesc); extern void flush_rowtype_cache(Oid type_id); |