Re: Add a filed to PageHeaderData - Mailing list pgsql-hackers

From Soroosh Sardari
Subject Re: Add a filed to PageHeaderData
Date
Msg-id CAFUsPDb0BQvENYqmL2J+heCXBWDTWmjBRxWsotdLuDvsaTEU2Q@mail.gmail.com
Whole thread Raw
In response to Re: Add a filed to PageHeaderData  (Pavan Deolasee <pavan.deolasee@gmail.com>)
Responses Re: Add a filed to PageHeaderData  (Abhijit Menon-Sen <ams@2ndquadrant.com>)
Re: Add a filed to PageHeaderData  (Kevin Grittner <kgrittn@ymail.com>)
List pgsql-hackers



On Tue, Jun 24, 2014 at 1:34 PM, Pavan Deolasee <pavan.deolasee@gmail.com> wrote:
On Tue, Jun 24, 2014 at 2:28 PM, Greg Stark <stark@mit.edu> wrote:
On Tue, Jun 24, 2014 at 12:02 AM, Soroosh Sardari
<soroosh.sardari@gmail.com> wrote:
> Is there any rule for adding a field to PageHeaderData?

Not really. It's a pretty internal thing, not something we expect
people to be doing all the time.

The only rule I can think of is that you should bump some version
numbers such as the page format version and probably the catalog
version. But that's probably irrelevant to your problem. It sounds
like you have a bug in your code but you haven't posted enough
information to say much more.


Out of curiosity, I actually tried adding a char[20] field in the page header because just like you I thought this should be completely internal, as long as the field is added before the pd_linp[] field. But I get the same failure that OP is reporting. I wonder if its a bug in gist index build, though I could not spot anything at the first glance. FWIW changing the char[] from 20 to 22 or 24 does not cause any failure in rangetypes test. So I am thinking its some alignment issue (mine is a 64 bit build)

Thanks,
Pavan
--
Pavan Deolasee
http://www.linkedin.com/in/pavandeolasee



I check this problem with a virgin source code of postgresql-9.3.2. So the bug is not for my codes.
As Pavan said, may be some alignment issues cause this problem.
By the way, following code has two different output and it is weird.

drop table if exists test_range_spgist;
create table test_range_spgist(ir int4range);
create index test_range_spgist_idx on test_range_spgist using spgist (ir);
insert into test_range_spgist select int4range(g, g+10) from
generate_series(1,590) g;


SET enable_seqscan    = t;
SET enable_indexscan  = f;
SET enable_bitmapscan = f;

select * from test_range_spgist where ir -|- int4range(100,500);

SET enable_seqscan    = f;
SET enable_indexscan  = t;
SET enable_bitmapscan = f;

select * from test_range_spgist where ir -|- int4range(100,500);


Regards,
Soroosh

pgsql-hackers by date:

Previous
From: Christian Ullrich
Date:
Subject: Re: PostgreSQL in Windows console and Ctrl-C
Next
From: Abhijit Menon-Sen
Date:
Subject: Re: Add a filed to PageHeaderData