mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Still more paranoia in PageAddItem: disallow specification of an item
offset past the last-used-item-plus-one, since that would result in leaving uninitialized holes in the item pointer array. AFAICT the only place that was depending on this was btree index build, which was being cavalier about when to fill in the P_HIKEY pointer; easily fixed. Also a small performance improvement: shuffle itemid's by means of memmove, not a one-at-a-time loop.
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsort.c,v 1.65 2002/07/02 05:48:44 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsort.c,v 1.66 2002/08/06 19:41:23 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -187,10 +187,17 @@ _bt_blnewpage(Relation index, Buffer *buf, Page *page, int flags)
|
||||
|
||||
*buf = _bt_getbuf(index, P_NEW, BT_WRITE);
|
||||
*page = BufferGetPage(*buf);
|
||||
|
||||
/* Zero the page and set up standard page header info */
|
||||
_bt_pageinit(*page, BufferGetPageSize(*buf));
|
||||
|
||||
/* Initialize BT opaque state */
|
||||
opaque = (BTPageOpaque) PageGetSpecialPointer(*page);
|
||||
opaque->btpo_prev = opaque->btpo_next = P_NONE;
|
||||
opaque->btpo_flags = flags;
|
||||
|
||||
/* Make the P_HIKEY line pointer appear allocated */
|
||||
((PageHeader) *page)->pd_lower += sizeof(ItemIdData);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user