Re: pg_controldata doesn't report 64/32bit? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pg_controldata doesn't report 64/32bit?
Date
Msg-id 5109.1197099981@sss.pgh.pa.us
Whole thread Raw
In response to Re: pg_controldata doesn't report 64/32bit?  (Gregory Stark <stark@enterprisedb.com>)
Responses Re: pg_controldata doesn't report 64/32bit?  (Simon Riggs <simon@2ndquadrant.com>)
List pgsql-hackers
Gregory Stark <stark@enterprisedb.com> writes:
> We could always tighten this up a bit by listing the alignment of a
> handful of built-in data types but I suppose there will always be
> holes in this area anyways.

In theory yeah, but the note in pg_control.h still applies to every
platform I've heard of:
    * This data is used to check for hardware-architecture compatibility of    * the database and the backend
executable. We need not check endianness    * explicitly, since the pg_control version will surely look wrong to a    *
machineof different endianness, but we do need to worry about MAXALIGN    * and floating-point format.  (Note: storage
layoutnominally also    * depends on SHORTALIGN and INTALIGN, but in practice these are the same    * on all
architecturesof interest.)
 

The main risk we are taking is in the assumption that int64 and float8
have the same alignment requirement, ie DOUBLEALIGN.  Which is probably
a fairly safe thing in reality.  Also, we've so far avoided using either
type in the system catalogs, which takes away one of the possible
failure modes (that the C compiler's alignment of struct fields might
vary from what we think the type needs).
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_controldata doesn't report 64/32bit?
Next
From: Simon Riggs
Date:
Subject: Re: pg_controldata doesn't report 64/32bit?