Re: documentation inconsistent re: alignment

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Chapman Flack <chap(at)anastigmatix(dot)net>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: documentation inconsistent re: alignment
Date: 2019-11-12 15:23:49
Message-ID: 1889.1573572229@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Chapman Flack <chap(at)anastigmatix(dot)net> writes:
> On 10/20/19 14:47, Tom Lane wrote:
>> Probably the statement in CREATE TYPE is too strong. There are, I
>> believe, still machines in the buildfarm where maxalign is just 4.

> So just closing the circle on this, the low-down seems to be that
> the alignments called s, i, and d (by pg_type), and int2, int4, and
> double (by CREATE TYPE) refer to the machine values configure picks
> for ALIGNOF_SHORT, ALIGNOF_INT, and ALIGNOF_DOUBLE, respectively.

Right.

> And while configure also defines an ALIGNOF_LONG, and there are
> LONGALIGN macros in c.h that use it, that one isn't a choice when
> creating a type, presumably because it's never been usefully different
> on any interesting platform?

The problem with "long int" is that it's 32 bits on some platforms
and 64 bits on others, so it's not terribly useful as a basis for
a user-visible SQL type. That's why it's not accounted for in the
typalign options. I think ALIGNOF_LONG is just there for completeness'
sake --- it doesn't look to me like we actually use that, or LONGALIGN,
anyplace.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2019-11-12 15:25:06 Re: Ought to use heap_multi_insert() for pg_attribute/depend insertions?
Previous Message Tom Lane 2019-11-12 15:19:30 Re: Missing dependency tracking for TableFunc nodes