summaryrefslogtreecommitdiff
path: root/src/backend/access/gin/gininsert.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-10-02 21:14:11 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-10-02 21:14:11 +0000
commitc3110e49b1601941e0173e8d75378f943b4ca6fd (patch)
tree3cb0a453fe9e193f38e8796e9281c8274bc96f28 /src/backend/access/gin/gininsert.c
parentac317a8474e7c2e2c67ee37f8cb1a6511eb662d9 (diff)
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.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/backend/access/gin/gininsert.c b/src/backend/access/gin/gininsert.c
index 2adaed43d48..aaa4d998021 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.22 2009/06/11 14:48:53 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/gininsert.c,v 1.22.2.1 2009/10/02 21:14:11 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);