diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-10-02 21:14:04 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-10-02 21:14:04 +0000 |
commit | e66d714386cd3040b328d6a894802d01dd1d395d (patch) | |
tree | 9971031124162948d5e1d622f9dff8f59d9049d1 /src/backend/access/gin/gininsert.c | |
parent | d691cb91415542e398aa6ad015ea6a5eab53ab0d (diff) | |
download | postgresql-e66d714386cd3040b328d6a894802d01dd1d395d.tar.gz postgresql-e66d714386cd3040b328d6a894802d01dd1d395d.zip |
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
Diffstat (limited to 'src/backend/access/gin/gininsert.c')
-rw-r--r-- | src/backend/access/gin/gininsert.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/backend/access/gin/gininsert.c b/src/backend/access/gin/gininsert.c index d175a5a99e6..17f88f62d16 100644 --- a/src/backend/access/gin/gininsert.c +++ b/src/backend/access/gin/gininsert.c @@ -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); |