Commit 56303abf authored by Tom Lane's avatar Tom Lane

Tweak toast-related logic in heapam.c so that the toaster is only invoked

when relkind = RELKIND_RELATION.  This syncs these tests with the Asserts
in tuptoaster.c, and ensures that we won't ever try to, for example,
compress a sequence's tuple.  Problem found by Greg Stark while stress-testing
with much-smaller-than-normal page sizes.
parent 9a4b29d8
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.242 2007/09/21 21:25:42 tgl Exp $ * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.243 2007/10/16 17:05:26 tgl Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
...@@ -1758,7 +1758,7 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid, ...@@ -1758,7 +1758,7 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid,
* Note: below this point, heaptup is the data we actually intend to store * Note: below this point, heaptup is the data we actually intend to store
* into the relation; tup is the caller's original untoasted data. * into the relation; tup is the caller's original untoasted data.
*/ */
if (relation->rd_rel->relkind == RELKIND_TOASTVALUE) if (relation->rd_rel->relkind != RELKIND_RELATION)
{ {
/* toast table entries should never be recursively toasted */ /* toast table entries should never be recursively toasted */
Assert(!HeapTupleHasExternal(tup)); Assert(!HeapTupleHasExternal(tup));
...@@ -2125,7 +2125,7 @@ l1: ...@@ -2125,7 +2125,7 @@ l1:
* because we need to look at the contents of the tuple, but it's OK to * because we need to look at the contents of the tuple, but it's OK to
* release the content lock on the buffer first. * release the content lock on the buffer first.
*/ */
if (relation->rd_rel->relkind == RELKIND_TOASTVALUE) if (relation->rd_rel->relkind != RELKIND_RELATION)
{ {
/* toast table entries should never be recursively toasted */ /* toast table entries should never be recursively toasted */
Assert(!HeapTupleHasExternal(&tp)); Assert(!HeapTupleHasExternal(&tp));
...@@ -2440,7 +2440,7 @@ l2: ...@@ -2440,7 +2440,7 @@ l2:
* We need to invoke the toaster if there are already any out-of-line * We need to invoke the toaster if there are already any out-of-line
* toasted values present, or if the new tuple is over-threshold. * toasted values present, or if the new tuple is over-threshold.
*/ */
if (relation->rd_rel->relkind == RELKIND_TOASTVALUE) if (relation->rd_rel->relkind != RELKIND_RELATION)
{ {
/* toast table entries should never be recursively toasted */ /* toast table entries should never be recursively toasted */
Assert(!HeapTupleHasExternal(&oldtup)); Assert(!HeapTupleHasExternal(&oldtup));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment