Re: BUG #19062: PostgreSQL 12.22 does not compile because of conflicting types for CollationCreate - Mailing list pgsql-bugs

From Thomas Munro
Subject Re: BUG #19062: PostgreSQL 12.22 does not compile because of conflicting types for CollationCreate
Date
Msg-id CA+hUKGLBMYh-CFM6imQdcrZ0ROsR6k1Lcf2Lpf_1mH4kZ=Jr3Q@mail.gmail.com
Whole thread Raw
In response to Re: BUG #19062: PostgreSQL 12.22 does not compile because of conflicting types for CollationCreate  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Thu, Sep 25, 2025 at 2:41 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> PG Bug reporting form <noreply@postgresql.org> writes:
> > With default compiler /usr/bin/gcc-4.2 (powerpc-apple-darwin9-gcc-4.2.1
> > (GCC) 4.2.1 (Apple Inc. build 5577)) the error is:
> > pg_collation.c:55: error: conflicting types for ‘CollationCreate’
>
> PG 12 is EOL, so we won't be doing anything about this.  However,
> it's evident from your messages that the problem is something
> about "bool" (probably our typedef as "char") versus "_Bool"
> (C99 <stdbool.h>).  If you need a fix for PG 12, you might get
> somewhere by trawling later branches' commit history for fixes
> related to that.

We didn't resolve that in a way that would work for (old) macOS/PPC,
where sizeof(_Bool) was 4 (it was the last known system to have a size
other than 1).  But if you want a hackish solution for archeological
purposes, let's see...

REL_12_STABLE's c.h says:

#if defined(HAVE_STDBOOL_H) && SIZEOF_BOOL == 1
#include <stdbool.h>
#define USE_STDBOOL 1
#else

#ifndef bool
typedef unsigned char bool;  <-- macOS/PPC would do this, not the thing above
#endif

I assume that <stdbool.h> is being included indirectly later by some
other system header, and that's defining bool to _Bool and thus hiding
our typedef.  I don't know what changed since we used to test on that
platform a few years ago, but perhaps you could try messing with
<stdbool.h>'s include guard by defining __STDBOOL_H?  Or something
along those lines, either with -D or in c.h.

Obviously it's not great that some libraries would use a different
size for "bool".  We don't do that any more, in recent releases.



pgsql-bugs by date:

Previous
From: Etsuro Fujita
Date:
Subject: Re: TRAP: failed Assert("outerPlan != NULL") in postgres_fdw.c
Next
From: David Rowley
Date:
Subject: Re: The issue of incorrect width estimation in UNION queries