Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tIwns-0002UJ-8A for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Dec 2024 21:21:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tIwnp-002Y7q-7q for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Dec 2024 21:20:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tIwno-002Y7i-TI for pgsql-hackers@lists.postgresql.org; Wed, 04 Dec 2024 21:20:58 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tIwnn-0014UR-DD for pgsql-hackers@lists.postgresql.org; Wed, 04 Dec 2024 21:20:56 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 4B4LKbtE2397644; Wed, 4 Dec 2024 16:20:37 -0500 From: Tom Lane To: Thomas Munro cc: Tomas Vondra , Peter Eisentraut , Heikki Linnakangas , Japin Li , Andres Freund , PostgreSQL Hackers Subject: Re: Cannot find a working 64-bit integer type on Illumos In-reply-to: <2385947.1733341279@sss.pgh.pa.us> References: <20240322165305.6zrtxcmzdrywvmsu@awork3.anarazel.de> <944094.1711128356@sss.pgh.pa.us> <1229869.1711160593@sss.pgh.pa.us> <7cf1dcb7-306f-4418-bf25-bdc75130db10@eisentraut.org> <0e2cc7af-f0c0-418c-b640-e5eb03eaa6e6@eisentraut.org> <50a4c05e-c43e-4e7e-95d2-4b16493073ed@eisentraut.org> <2276817.1733293172@sss.pgh.pa.us> <2385947.1733341279@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Wed, 04 Dec 2024 14:41:19 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2397642.1733347237.1@sss.pgh.pa.us> Date: Wed, 04 Dec 2024 16:20:37 -0500 Message-ID: <2397643.1733347237@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > So apparently, "off_t" was the same as "loff_t" before 962da900a, > but it no longer is the same on 32-bit machines. OK, I see what is happening. On platforms that need it, we define _FILE_OFFSET_BITS as 64 in pg_config.h to ensure that off_t is big enough. However, 962da900a did this: --- a/src/include/postgres_ext.h +++ b/src/include/postgres_ext.h @@ -23,7 +23,7 @@ #ifndef POSTGRES_EXT_H #define POSTGRES_EXT_H -#include "pg_config_ext.h" +#include Since c.h reads postgres_ext.h first, is now pulled in before pg_config.h, and that in turn pulls in , which locks down the decision that off_t will be 32 bits, as well as some other decisions we don't want. We can NOT include any system headers before pg_config.h; I'm surprised we're not seeing related failures on the Solaris-en, where _LARGEFILE_SOURCE is similarly critical. Another rather serious problem here is that we no longer provide macro PG_INT64_TYPE, which seems rather likely to break applications that were relying on it. That is part of our external API, we can't just remove it on a whim. I think the least painful solution would be to revert the parts of 962da900a that got rid of pg_config_ext.h and PG_INT64_TYPE. Since PG_INT64_TYPE is a macro not a typedef, it might be okay to #define it as int64_t even before we've read that header, so as not to give up the principle of relying on stdint.h for the underlying definition. Now that I see this, I'm fairly astonished that there aren't more problems than we've noticed. I wonder whether it'd be a good idea to put in a static assert somewhere about the width of off_t, so that the next screwup of this sort will be easier to diagnose. regards, tom lane