Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9dde24e

Browse files
committed
Back-patch fix for oversize index tuples during index creation.
1 parent6580668 commit9dde24e

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

‎src/backend/access/nbtree/nbtsort.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
*
77
* IDENTIFICATION
8-
* $Id: nbtsort.c,v 1.40.2.1 1999/08/02 05:24:41 scrappy Exp $
8+
* $Id: nbtsort.c,v 1.40.2.2 2000/01/08 21:47:31 tgl Exp $
99
*
1010
* NOTES
1111
*
@@ -904,6 +904,23 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
904904
pgspc=PageGetFreeSpace(npage);
905905
btisz=BTITEMSZ(bti);
906906
btisz=MAXALIGN(btisz);
907+
908+
/*
909+
* Check whether the item can fit on a btree page at all.
910+
* (Eventually, we ought to try to apply TOAST methods if not.)
911+
* We actually need to be able to fit three items on every page,
912+
* so restrict any one item to 1/3 the per-page available space.
913+
* Note that at this point, btisz doesn't include the ItemId.
914+
*
915+
* NOTE: similar code appears in _bt_insertonpg() to defend against
916+
* oversize items being inserted into an already-existing index.
917+
* But during creation of an index, we don't go through there.
918+
*/
919+
if (btisz> (PageGetPageSize(npage)-sizeof(PageHeaderData)-MAXALIGN(sizeof(BTPageOpaqueData)))/3-sizeof(ItemIdData))
920+
elog(ERROR,"btree: index item size %d exceeds maximum %d",
921+
btisz,
922+
(PageGetPageSize(npage)-sizeof(PageHeaderData)-MAXALIGN(sizeof(BTPageOpaqueData)))/3-sizeof(ItemIdData));
923+
907924
if (pgspc<btisz)
908925
{
909926
Bufferobuf=nbuf;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp