Re: BRIN page type identifier

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: BRIN page type identifier
Date: 2015-03-09 23:34:41
Message-ID: 8620.1425944081@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> I wonder if this is permissible and whether it will do the right thing
> on 32-bit systems:

> /*
> * Special area of BRIN pages.
> *
> * We add some padding bytes to ensure that 'type' ends up in the last two
> * bytes of the page, for consumption by pg_filedump and similar utilities.
> * (Special space is MAXALIGN'ed).
> */
> typedef struct BrinSpecialSpace
> {
> char padding[MAXALIGN(1) - 2 * sizeof(uint16)];
> uint16 flags;
> uint16 type;
> } BrinSpecialSpace;

I should expect that to fail altogether on 32-bit machines, because
the declared array size will be zero.

You could try something like

typedef struct BrinSpecialSpace
{
uint16 vector[MAXALIGN(1) / sizeof(uint16)];
} BrinSpecialSpace;

and then some access macros to use the last and next-to-last
elements of that array.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2015-03-10 00:18:19 Re: Documentation of bt_page_items()'s ctid field
Previous Message Andreas Karlsson 2015-03-09 23:31:55 Re: patch : Allow toast tables to be moved to a different tablespace