1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-08 11:42:09 +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

@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/gin/gininsert.c,v 1.23 2009/07/29 20:56:17 tgl Exp $
* $PostgreSQL: pgsql/src/backend/access/gin/gininsert.c,v 1.24 2009/10/02 21:14:04 tgl Exp $
*-------------------------------------------------------------------------
*/
@ -102,8 +102,9 @@ addItemPointersToTuple(Relation index, GinState *ginstate, GinBtreeStack *stack,
{
Datum key = gin_index_getattr(ginstate, old);
OffsetNumber attnum = gintuple_get_attrnum(ginstate, old);
IndexTuple res = GinFormTuple(ginstate, attnum, key,
NULL, nitem + GinGetNPosting(old));
IndexTuple res = GinFormTuple(index, ginstate, attnum, key,
NULL, nitem + GinGetNPosting(old),
false);
if (res)
{
@ -122,7 +123,7 @@ addItemPointersToTuple(Relation index, GinState *ginstate, GinBtreeStack *stack,
GinPostingTreeScan *gdi;
/* posting list becomes big, so we need to make posting's tree */
res = GinFormTuple(ginstate, attnum, key, NULL, 0);
res = GinFormTuple(index, ginstate, attnum, key, NULL, 0, true);
postingRoot = createPostingTree(index, GinGetPosting(old), GinGetNPosting(old));
GinSetPostingTree(res, postingRoot);
@ -185,13 +186,12 @@ ginEntryInsert(Relation index, GinState *ginstate,
}
else
{
/* We suppose, that tuple can store at list one itempointer */
itup = GinFormTuple(ginstate, attnum, value, items, 1);
if (itup == NULL || IndexTupleSize(itup) >= GinMaxItemSize)
elog(ERROR, "huge tuple");
/* We suppose that tuple can store at least one itempointer */
itup = GinFormTuple(index, ginstate, attnum, value, items, 1, true);
if (nitem > 1)
{
/* Add the rest, making a posting tree if necessary */
IndexTuple previtup = itup;
itup = addItemPointersToTuple(index, ginstate, stack, previtup, items + 1, nitem - 1, isBuild);