mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
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
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.211 2006/04/22 01:25:59 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.212 2006/06/16 18:42:22 tgl Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@@ -1418,12 +1418,19 @@ rowtype_field_matches(Oid rowtypeid, int fieldnum,
|
||||
return true;
|
||||
tupdesc = lookup_rowtype_tupdesc(rowtypeid, -1);
|
||||
if (fieldnum <= 0 || fieldnum > tupdesc->natts)
|
||||
{
|
||||
ReleaseTupleDesc(tupdesc);
|
||||
return false;
|
||||
}
|
||||
attr = tupdesc->attrs[fieldnum - 1];
|
||||
if (attr->attisdropped ||
|
||||
attr->atttypid != expectedtype ||
|
||||
attr->atttypmod != expectedtypmod)
|
||||
{
|
||||
ReleaseTupleDesc(tupdesc);
|
||||
return false;
|
||||
}
|
||||
ReleaseTupleDesc(tupdesc);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user