From e66d714386cd3040b328d6a894802d01dd1d395d Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 2 Oct 2009 21:14:04 +0000 Subject: Make sure that GIN fast-insert and regular code paths enforce the same tuple size limit. Improve the error message for index-tuple-too-large so that it includes the actual size, the limit, and the index name. Sync with the btree occurrences of the same error. Back-patch to 8.4 because it appears that the out-of-sync problem is occurring in the field. Teodor and Tom --- src/backend/access/gin/ginfast.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src/backend/access/gin/ginfast.c') diff --git a/src/backend/access/gin/ginfast.c b/src/backend/access/gin/ginfast.c index 9d2351af529..a5d02e74a13 100644 --- a/src/backend/access/gin/ginfast.c +++ b/src/backend/access/gin/ginfast.c @@ -11,7 +11,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gin/ginfast.c,v 1.4 2009/09/15 20:31:30 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/gin/ginfast.c,v 1.5 2009/10/02 21:14:04 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -20,7 +20,6 @@ #include "access/genam.h" #include "access/gin.h" -#include "access/tuptoaster.h" #include "catalog/index.h" #include "commands/vacuum.h" #include "miscadmin.h" @@ -465,16 +464,10 @@ ginHeapTupleFastCollect(Relation index, GinState *ginstate, */ for (i = 0; i < nentries; i++) { - int32 tupsize; - - collector->tuples[collector->ntuples + i] = GinFormTuple(ginstate, attnum, entries[i], NULL, 0); + collector->tuples[collector->ntuples + i] = + GinFormTuple(index, ginstate, attnum, entries[i], NULL, 0, true); collector->tuples[collector->ntuples + i]->t_tid = *item; - tupsize = IndexTupleSize(collector->tuples[collector->ntuples + i]); - - if (tupsize > TOAST_INDEX_TARGET || tupsize >= GinMaxItemSize) - elog(ERROR, "huge tuple"); - - collector->sumsize += tupsize; + collector->sumsize += IndexTupleSize(collector->tuples[collector->ntuples + i]); } collector->ntuples += nentries; -- cgit v1.2.3