ICU bool problem

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: ICU bool problem
Date: 2021-05-17 20:56:54
Message-ID: 28588e5a-c204-0361-01f1-a1ee1b590233@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

You might find that ICU 69 (pretty new, see
http://site.icu-project.org/download/69) will cause compile failures
with PG 10 (pretty old). ICU 69 has switched to using stdbool.h, which
conflicts with the home-made definitions that we used until PG10.
Compile errors look like this:

pg_collation.c:47:1: error: conflicting types for 'CollationCreate'
47 | CollationCreate(const char *collname, Oid collnamespace,
| ^~~~~~~~~~~~~~~
In file included from pg_collation.c:25:
../../../src/include/catalog/pg_collation_fn.h:17:12: note: previous
declaration of 'CollationCreate' was here
17 | extern Oid CollationCreate(const char *collname, Oid collnamespace,
| ^~~~~~~~~~~~~~~
pg_collation.c: In function 'CollationCreate':
pg_collation.c:171:41: warning: passing argument 3 of 'heap_form_tuple'
from incompatible pointer type [-Wincompatible-pointer-types]
171 | tup = heap_form_tuple(tupDesc, values, nulls);
| ^~~~~
| |
| _Bool *
In file included from pg_collation.c:19:
../../../src/include/access/htup_details.h:802:26: note: expected 'bool
*' {aka 'char *'} but argument is of type '_Bool *'
802 | Datum *values, bool *isnull);
| ~~~~~~^~~~~~

The fix is like what we used to use for plperl back then:

diff --git a/src/include/utils/pg_locale.h b/src/include/utils/pg_locale.h
index f3e04d4d8c..499ada2b69 100644
--- a/src/include/utils/pg_locale.h
+++ b/src/include/utils/pg_locale.h
@@ -17,6 +17,9 @@
#endif
#ifdef USE_ICU
#include <unicode/ucol.h>
+#ifdef bool
+#undef bool
+#endif
#endif

#include "utils/guc.h"

I'll prepare a full patch in a bit.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2021-05-17 21:01:16 Re: ICU bool problem
Previous Message Tom Lane 2021-05-17 20:53:09 Re: pgsql: Move tablespace path re-creation from the makefiles to pg_regres