Re: Cannot find a working 64-bit integer type on Illumos

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Tomas Vondra <tomas(at)vondra(dot)me>, Peter Eisentraut <peter(at)eisentraut(dot)org>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Japin Li <japinli(at)hotmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Cannot find a working 64-bit integer type on Illumos
Date: 2024-12-04 23:16:31
Message-ID: 2412342.1733354191@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thomas Munro <thomas(dot)munro(at)gmail(dot)com> writes:
> On Thu, Dec 5, 2024 at 10:58 AM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
>> On Thu, Dec 5, 2024 at 10:55 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> Could another way be to read pg_config.h before postgres_ext.h?
>>> I think the current order was intentional, but maybe the
>>> disadvantages outweigh the advantages now.

> Seems good to me. Also there were another couple of contortions due
> to the older ordering, which we could improve I think?

In c.h, I'd put in a very explicit comment in front of pg_config.h.
Also, I don't like making it look like postgres_ext.h is of the
same ilk as the config headers, since it isn't. So maybe like

/*
* These headers must be included before any system headers, because
* on some platforms they affect the behavior of the system headers
* (for example, by defining _FILE_OFFSET_BITS).
*/
#include "pg_config.h"
#include "pg_config_manual.h" /* must be after pg_config.h */
#include "pg_config_os.h" /* must be before any system header files */

/* Pull in fundamental symbols that we also expose to applications */
#include "postgres_ext.h"

/* System header files that should be available everywhere in Postgres */
#include <inttypes.h>
...

The comment for pg_config_os.h is redundant this way, maybe we could
rewrite it as something more useful?

Also, there's probably no reason anymore that postgres_ext.h couldn't
be placed after those fundamental system headers, and that might be
clearer. (I think perhaps the main reason for the existing ordering
was to demonstrate that postgres_ext.h could be included before any
system headers, and that's no longer a consideration.)

I don't especially care for your proposed changes to postgres_ext.h.
That substantially expands the footprint of what gets defined by
pulling that in, and some users might not care for that. (For
example, because they have ordering assumptions similar to what we're
dealing with here.) Now you already snuck the camel's nose under the
tent by including stdint.h there, and maybe these additional headers
wouldn't do any further damage. But I don't see a strong argument to
change long-standing external APIs any more than we absolutely must.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthias van de Meent 2024-12-04 23:23:54 Re: Make tuple deformation faster
Previous Message Jelte Fennema-Nio 2024-12-04 23:05:00 Re: SCRAM pass-through authentication for postgres_fdw