Re: Decoupling our alignment assumptions about int64 and double

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Andres Freund <andres@anarazel.de>, pgsql-hackers@lists.postgresql.org
Date: 2026-02-07T02:42:52Z
Lists: pgsql-hackers

Attachments

I wrote:
> Your thought of maybe applying some compiler ju-jitsu led me to a
> different research direction: if we can get the compiler to lay out
> the catalog structs as if DOUBLEALIGN and LONGALIGN were 4, then
> problem solved without need for any user-table compatibility break.
> And we can: it looks like inserting
> 	#pragma pack(4)
> before each catalog struct definition (and then "#pragma pack()"
> afterwards to restore the normal rules) would do the trick.

Here's a POC patch to fix AIX's alignment problems that way.
I feel much better about this approach than the other one ...

			regards, tom lane

Commits

  1. Cope with AIX's alignment woes by using _Pragma("pack").

  2. Make some minor cleanups in typalign-related code.

  3. Refactor att_align_nominal() to improve performance.