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

Peter Dyballa <peter_dyballa@web.de>

From: Peter Dyballa <Peter_Dyballa@Web.DE>
To: pgsql-bugs@lists.postgresql.org
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Thomas Munro <thomas.munro@gmail.com>
Date: 2025-10-01T10:46:31Z
Lists: pgsql-bugs
Pre-processing with GCC 4.2 or GCC 14.2 I get both times the same definition from src/include/catalog/pg_collation.h:

	extern Oid CollationCreate(const char *collname, Oid collnamespace,
	       Oid collowner,
	       char collprovider,
	       bool collisdeterministic,
	       int32 collencoding,
	       const char *collcollate, const char *collctype,
	       const char *collversion,
	       bool if_not_exists,
	       bool quiet);
	extern void RemoveCollationById(Oid collationOid);

From src/backend/catalog/pg_collation.c I get (4.2 vs. 14.2)

	#define ReleaseSysCacheList(x) ReleaseCatCacheList(x)
	# 33 "pg_collation.c" 2
	# 45 "pg_collation.c"
	Oid
	CollationCreate(const char *collname, Oid collnamespace,
	    Oid collowner,
	    char collprovider,
	    _Bool collisdeterministic,
	    int32 collencoding,
	    const char *collcollate, const char *collctype,
	    const char *collversion,
	    _Bool if_not_exists,
	    _Bool quiet)
	{
	 Relation rel;
	 TupleDesc tupDesc;
	 HeapTuple tup;
	 Datum values[10];
	 _Bool nulls[10];
	 NameData name_name,
	    name_collate,
	    name_ctype;
	 Oid oid;
	 ObjectAddress myself,
	    referenced;

vs.

	#define ReleaseSysCacheList(x) ReleaseCatCacheList(x)
	# 33 "pg_collation.c" 2
	# 45 "pg_collation.c"
	Oid
	CollationCreate(const char *collname, Oid collnamespace,
	    Oid collowner,
	    char collprovider,
	    
	# 49 "pg_collation.c" 3 4
	   _Bool 
	# 49 "pg_collation.c"
	        collisdeterministic,
	    int32 collencoding,
	    const char *collcollate, const char *collctype,
	    const char *collversion,
	    
	# 53 "pg_collation.c" 3 4
	   _Bool 
	# 53 "pg_collation.c"
	        if_not_exists,
	    
	# 54 "pg_collation.c" 3 4
	   _Bool 
	# 54 "pg_collation.c"
	        quiet)
	{
	 Relation rel;
	 TupleDesc tupDesc;
	 HeapTuple tup;
	 Datum values[10];
	 
	# 60 "pg_collation.c" 3 4
	_Bool 
	# 60 "pg_collation.c"
	      nulls[10];
	 NameData name_name,
	    name_collate,
	    name_ctype;
	 Oid oid;
	 ObjectAddress myself,
	    referenced;

which both are adequate. _Bool is #defined by the C compiler: 

	# 32 "/usr/lib/gcc/powerpc-apple-darwin9/4.2.1/include/stdbool.h" 3 4
	#define _STDBOOL_H 
	
	
	
	#define bool _Bool
	#define true 1
	#define false 0
	# 51 "/usr/lib/gcc/powerpc-apple-darwin9/4.2.1/include/stdbool.h" 3 4
	#define __bool_true_false_are_defined 1
	# 53 "/opt/local/include/libxml2/unicode/umachine.h" 2
	
vs. 
	
	# 29 "/opt/local/lib/gcc14/gcc/powerpc-apple-darwin9/14.2.0/include/stdbool.h" 3 4
	#define _STDBOOL_H 







	#define bool _Bool
	#define true 1
	#define false 0
	# 49 "/opt/local/lib/gcc14/gcc/powerpc-apple-darwin9/14.2.0/include/stdbool.h" 3 4
	#define __bool_true_false_are_defined 1
	# 53 "/opt/local/include/libxml2/unicode/umachine.h" 2

My understanding of C is too limited to see an error and find a solution. So let's leave it!


--

Greetings

  Pete

If the majority of cooking accidents happen in the kitchen, then why don't we just cook in other rooms?