PageAddItem in overwrite mode: must *NOT* check itemid' flag if

OffsetNumber == MaxOffsetNumber + 1 - there may be garbage there!
This commit is contained in:
Vadim B. Mikheev 2001-02-06 06:24:00 +00:00
parent 3869b08859
commit 21d08bc1f6

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.35 2001/01/24 19:43:08 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.36 2001/02/06 06:24:00 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@ -112,12 +112,15 @@ PageAddItem(Page page,
elog(NOTICE, "PageAddItem: tried overwrite after maxoff");
return InvalidOffsetNumber;
}
itemId = &((PageHeader) page)->pd_linp[offsetNumber - 1];
if (((*itemId).lp_flags & LP_USED) ||
((*itemId).lp_len != 0))
if (offsetNumber < limit)
{
elog(NOTICE, "PageAddItem: tried overwrite of used ItemId");
return InvalidOffsetNumber;
itemId = &((PageHeader) page)->pd_linp[offsetNumber - 1];
if (((*itemId).lp_flags & LP_USED) ||
((*itemId).lp_len != 0))
{
elog(NOTICE, "PageAddItem: tried overwrite of used ItemId");
return InvalidOffsetNumber;
}
}
}
else