mirror of
https://github.com/postgres/postgres.git
synced 2025-05-21 15:54:08 +03:00
Check for GiST index tuples that don't fit on a page.
The page splitting code would go into infinite recursion if you try to insert an index tuple that doesn't fit even on an empty page. Per analysis and suggested fix by Andrew Gierth. Fixes bug #11555, reported by Bryan Seitz (analysis happened over IRC). Backpatch to all supported versions.
This commit is contained in:
parent
a19423b22e
commit
8e137b075d
@ -1255,6 +1255,23 @@ gistSplit(Relation r,
|
|||||||
int i;
|
int i;
|
||||||
SplitedPageLayout *res = NULL;
|
SplitedPageLayout *res = NULL;
|
||||||
|
|
||||||
|
/* this should never recurse very deeply, but better safe than sorry */
|
||||||
|
check_stack_depth();
|
||||||
|
|
||||||
|
/* there's no point in splitting an empty page */
|
||||||
|
Assert(len > 0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If a single tuple doesn't fit on a page, no amount of splitting will
|
||||||
|
* help.
|
||||||
|
*/
|
||||||
|
if (len == 1)
|
||||||
|
ereport(ERROR,
|
||||||
|
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
|
||||||
|
errmsg("index row size %zu exceeds maximum %zu for index \"%s\"",
|
||||||
|
IndexTupleSize(itup[0]), GiSTPageSize,
|
||||||
|
RelationGetRelationName(r))));
|
||||||
|
|
||||||
memset(v.spl_lisnull, TRUE, sizeof(bool) * giststate->tupdesc->natts);
|
memset(v.spl_lisnull, TRUE, sizeof(bool) * giststate->tupdesc->natts);
|
||||||
memset(v.spl_risnull, TRUE, sizeof(bool) * giststate->tupdesc->natts);
|
memset(v.spl_risnull, TRUE, sizeof(bool) * giststate->tupdesc->natts);
|
||||||
gistSplitByKey(r, page, itup, len, giststate, &v, 0);
|
gistSplitByKey(r, page, itup, len, giststate, &v, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user