Re: BUG #19062: PostgreSQL 12.22 does not compile because of conflicting types for CollationCreate

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: peter_dyballa(at)web(dot)de, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19062: PostgreSQL 12.22 does not compile because of conflicting types for CollationCreate
Date: 2025-09-28 23:47:52
Message-ID: CA+hUKGLBMYh-CFM6imQdcrZ0ROsR6k1Lcf2Lpf_1mH4kZ=Jr3Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Sep 25, 2025 at 2:41 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> PG Bug reporting form <noreply(at)postgresql(dot)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.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Rowley 2025-09-29 01:50:19 Re: The issue of incorrect width estimation in UNION queries
Previous Message Etsuro Fujita 2025-09-28 08:55:45 Re: TRAP: failed Assert("outerPlan != NULL") in postgres_fdw.c