Tom Lane <tgl@sss.pgh.pa.us> wrote:
> #define MAX_TUPLES_PER_PAGE ((BLCKSZ - 1) / (MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)) + sizeof(ItemIdData)) +
1)
> (I believe that both modules want a ceiling definition not a floor
> definition, ie round up any fraction. The -1 / +1 trick is of course
> just one way to get that.)
Don't you think about PageHeaderData? Also I guess a floor definition is ok
because 'number of tuples' is an integer. How about the following?
((BLCKSZ - offsetof(PageHeaderData, pd_linp)) / (MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)) +
sizeof(ItemIdData)))
> Also, is this something that should be in a common header file? If so
> which one? BLCKSZ, HeapTupleHeaderData, and ItemIdData are all defined
> in different places ...
Considering include-hierarchy, I think bufpage.h is a good place.
---
ITAGAKI Takahiro
NTT Cyber Space Laboratories