1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-11 10:01:57 +03:00

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
This commit is contained in:
Tom Lane
2009-10-02 21:14:04 +00:00
parent d691cb9141
commit e66d714386
7 changed files with 72 additions and 41 deletions

View File

@ -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;