unnecessary code in_bt_split - Mailing list pgsql-hackers

From Zdenek Kotala
Subject unnecessary code in_bt_split
Date
Msg-id 489620C5.5020504@sun.com
Whole thread Raw
Responses Re: unnecessary code in_bt_split  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I found that _bt_split function calls PageGetTempPage, but next call is 
_bt_page_init which clear all contents anyway. Is there any reason to call 
PageGetTempPage instead of palloc?

Original code:

00796     leftpage = PageGetTempPage(origpage, sizeof(BTPageOpaqueData));
00797     rightpage = BufferGetPage(rbuf);
00798
00799     _bt_pageinit(leftpage, BufferGetPageSize(buf));

Suggested code:

00796     leftpage = palloc(PageGetSize(origpage));
00797     rightpage = BufferGetPage(rbuf);
00798
00799     _bt_pageinit(leftpage, BufferGetPageSize(buf));

Any idea?
    thanks Zdenek



-- 
Zdenek Kotala              Sun Microsystems
Prague, Czech Republic     http://sun.com/postgresql



pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Mini improvement: statement_cost_limit
Next
From: Tom Lane
Date:
Subject: Re: unnecessary code in_bt_split