diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-01-17 17:33:37 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-01-17 17:33:37 +0000 |
commit | 754da88e19e56a6aaba06a57f45fdf1b5ae792a3 (patch) | |
tree | 0dcbed1bb16054939b9f794a0637532e71f582c0 /src/backend/access | |
parent | 8372956243a477a67f1d01674c86f0285f05ccbb (diff) | |
download | postgresql-754da88e19e56a6aaba06a57f45fdf1b5ae792a3.tar.gz postgresql-754da88e19e56a6aaba06a57f45fdf1b5ae792a3.zip |
Repair problems with the result of lookup_rowtype_tupdesc() possibly being
discarded by cache flush while still in use. This is a minimal patch that
just copies the tupdesc anywhere it could be needed across a flush. Applied
to back branches only; Neil Conway is working on a better long-term solution
for HEAD.
Diffstat (limited to 'src/backend/access')
-rw-r--r-- | src/backend/access/heap/tuptoaster.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/backend/access/heap/tuptoaster.c b/src/backend/access/heap/tuptoaster.c index c06b3b8d36a..02af9d8e455 100644 --- a/src/backend/access/heap/tuptoaster.c +++ b/src/backend/access/heap/tuptoaster.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/heap/tuptoaster.c,v 1.47 2005/01/01 05:43:06 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/heap/tuptoaster.c,v 1.47.4.1 2006/01/17 17:33:34 tgl Exp $ * * * INTERFACE ROUTINES @@ -820,6 +820,7 @@ toast_flatten_tuple_attribute(Datum value, if (tupleDesc == NULL) return value; /* not a composite type */ + tupleDesc = CreateTupleDescCopy(tupleDesc); att = tupleDesc->attrs; numAttrs = tupleDesc->natts; @@ -866,7 +867,10 @@ toast_flatten_tuple_attribute(Datum value, * If nothing to untoast, just return the original tuple. */ if (!need_change) + { + FreeTupleDesc(tupleDesc); return value; + } /* * Calculate the new size of the tuple. Header size should not @@ -903,6 +907,7 @@ toast_flatten_tuple_attribute(Datum value, for (i = 0; i < numAttrs; i++) if (toast_free[i]) pfree(DatumGetPointer(toast_values[i])); + FreeTupleDesc(tupleDesc); return PointerGetDatum(new_data); } |