Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostgreSQL 16 support #16

Open
devrimgunduz opened this issue Sep 11, 2023 · 5 comments
Open

PostgreSQL 16 support #16

devrimgunduz opened this issue Sep 11, 2023 · 5 comments

Comments

@devrimgunduz
Copy link

Hi @petere ,

Latest pguri release fails to build against v16. Some of the errors are probably GCC 13.2 errors as well. All are below. Can you please take a look?

Thanks!

Regards, Devrim

/usr/lib64/ccache/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Xclang -no-opaque-pointers -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2 -I. -I./ -I/usr/pgsql-16/include/server -I/usr/pgsql-16/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o uri.bc uri.c uri.c:152:20: error: incompatible integer to pointer conversion passing 'Datum' (aka 'unsigned long') to parameter of type 'const inet *' [-Wint-conversion] PG_RETURN_INET_P(DirectFunctionCall1(inet_in, CStringGetDatum(tmp))); ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/pgsql-16/include/server/fmgr.h:643:2: note: expanded from macro 'DirectFunctionCall1' DirectFunctionCall1Coll(func, InvalidOid, arg1) ^ /usr/pgsql-16/include/server/utils/inet.h:135:50: note: expanded from macro 'PG_RETURN_INET_P' #define PG_RETURN_INET_P(x) return InetPGetDatum(x) ^ /usr/pgsql-16/include/server/utils/inet.h:129:27: note: passing argument to parameter 'X' here InetPGetDatum(const inet *X) ^ uri.c:164:20: error: incompatible integer to pointer conversion passing 'Datum' (aka 'unsigned long') to parameter of type 'const inet *' [-Wint-conversion] PG_RETURN_INET_P(DirectFunctionCall1(inet_in, CStringGetDatum(tmp))); ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/pgsql-16/include/server/fmgr.h:643:2: note: expanded from macro 'DirectFunctionCall1' DirectFunctionCall1Coll(func, InvalidOid, arg1) ^ /usr/pgsql-16/include/server/utils/inet.h:135:50: note: expanded from macro 'PG_RETURN_INET_P' #define PG_RETURN_INET_P(x) return InetPGetDatum(x) ^ /usr/pgsql-16/include/server/utils/inet.h:129:27: note: passing argument to parameter 'X' here InetPGetDatum(const inet *X) ^ uri.c:302:25: error: incompatible integer to pointer conversion passing 'Datum' (aka 'unsigned long') to parameter of type 'const void *' [-Wint-conversion] PG_RETURN_ARRAYTYPE_P(makeArrayResult(astate, CurrentMemoryContext)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/pgsql-16/include/server/utils/array.h:258:54: note: expanded from macro 'PG_RETURN_ARRAYTYPE_P' #define PG_RETURN_ARRAYTYPE_P(x) PG_RETURN_POINTER(x) ^ /usr/pgsql-16/include/server/fmgr.h:361:53: note: expanded from macro 'PG_RETURN_POINTER' #define PG_RETURN_POINTER(x) return PointerGetDatum(x) ^ /usr/pgsql-16/include/server/postgres.h:322:29: note: passing argument to parameter 'X' here PointerGetDatum(const void *X) ^ 3 errors generated. make[1]: *** [/usr/pgsql-16/lib/pgxs/src/makefiles/../../src/Makefile.global:1080: uri.bc] Error 1 make[1]: *** Waiting for unfinished jobs.... In file included from uri.c:8: uri.c: In function 'uri_host_inet': /usr/pgsql-16/include/server/fmgr.h:643:9: warning: passing argument 1 of 'InetPGetDatum' makes pointer from integer without a cast [-Wint-conversion] 643 | DirectFunctionCall1Coll(func, InvalidOid, arg1) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | Datum {aka long unsigned int} /usr/pgsql-16/include/server/utils/inet.h:135:50: note: in definition of macro 'PG_RETURN_INET_P' 135 | #define PG_RETURN_INET_P(x) return InetPGetDatum(x) | ^ uri.c:152:34: note: in expansion of macro 'DirectFunctionCall1' 152 | PG_RETURN_INET_P(DirectFunctionCall1(inet_in, CStringGetDatum(tmp))); | ^~~~~~~~~~~~~~~~~~~ /usr/pgsql-16/include/server/utils/inet.h:129:27: note: expected 'const inet *' but argument is of type 'Datum' {aka 'long unsigned int'} 129 | InetPGetDatum(const inet *X) | ~~~~~~~~~~~~^ /usr/pgsql-16/include/server/fmgr.h:643:9: warning: passing argument 1 of 'InetPGetDatum' makes pointer from integer without a cast [-Wint-conversion] 643 | DirectFunctionCall1Coll(func, InvalidOid, arg1) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | Datum {aka long unsigned int} /usr/pgsql-16/include/server/utils/inet.h:135:50: note: in definition of macro 'PG_RETURN_INET_P' 135 | #define PG_RETURN_INET_P(x) return InetPGetDatum(x) | ^ uri.c:164:34: note: in expansion of macro 'DirectFunctionCall1' 164 | PG_RETURN_INET_P(DirectFunctionCall1(inet_in, CStringGetDatum(tmp))); | ^~~~~~~~~~~~~~~~~~~ /usr/pgsql-16/include/server/utils/inet.h:129:27: note: expected 'const inet *' but argument is of type 'Datum' {aka 'long unsigned int'} 129 | InetPGetDatum(const inet *X) | ~~~~~~~~~~~~^ In file included from /usr/pgsql-16/include/server/access/skey.h:19, from /usr/pgsql-16/include/server/access/genam.h:18, from /usr/pgsql-16/include/server/access/amapi.h:15, from /usr/pgsql-16/include/server/access/hash.h:20, from uri.c:2: uri.c: In function 'uri_path_array': uri.c:302:39: warning: passing argument 1 of 'PointerGetDatum' makes pointer from integer without a cast [-Wint-conversion] 302 | PG_RETURN_ARRAYTYPE_P(makeArrayResult(astate, CurrentMemoryContext)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | Datum {aka long unsigned int} /usr/pgsql-16/include/server/fmgr.h:361:53: note: in definition of macro 'PG_RETURN_POINTER' 361 | #define PG_RETURN_POINTER(x) return PointerGetDatum(x) | ^ uri.c:302:17: note: in expansion of macro 'PG_RETURN_ARRAYTYPE_P' 302 | PG_RETURN_ARRAYTYPE_P(makeArrayResult(astate, CurrentMemoryContext)); | ^~~~~~~~~~~~~~~~~~~~~ In file included from uri.c:1: /usr/pgsql-16/include/server/postgres.h:322:29: note: expected 'const void *' but argument is of type 'Datum' {aka 'long unsigned int'} 322 | PointerGetDatum(const void *X) | ~~~~~~~~~~~~^ In file included from /usr/pgsql-16/include/server/postgres.h:46: uri.c: In function 'parse_uri': /usr/pgsql-16/include/server/utils/elog.h:142:12: warning: this statement may fall through [-Wimplicit-fallthrough=] 142 | do { \ | ^ /usr/pgsql-16/include/server/utils/elog.h:164:9: note: in expansion of macro 'ereport_domain' 164 | ereport_domain(elevel, TEXTDOMAIN, __VA_ARGS__) | ^~~~~~~~~~~~~~ uri.c:41:25: note: in expansion of macro 'ereport' 41 | ereport(ERROR, | ^~~~~~~ uri.c:45:17: note: here 45 | default: | ^~~~~~~

@devrimgunduz
Copy link
Author

ping

@BenjaminLoesch
Copy link

I fixed this by some type casts in follwoing lines in uri.c

Line 153 original: PG_RETURN_INET_P(DirectFunctionCall1(inet_in, CStringGetDatum(tmp)));
Line 153 new: PG_RETURN_INET_P((inet *) (DirectFunctionCall1(inet_in, CStringGetDatum(tmp))));

Line 165 original: PG_RETURN_INET_P(DirectFunctionCall1(inet_in, CStringGetDatum(tmp)));
Line 165 new: PG_RETURN_INET_P((inet *) (DirectFunctionCall1(inet_in, CStringGetDatum(tmp))));

Line 303 original: PG_RETURN_ARRAYTYPE_P(makeArrayResult(astate, CurrentMemoryContext));
Line 303 new: PG_RETURN_ARRAYTYPE_P((Pointer)(makeArrayResult(astate, CurrentMemoryContext)));

with this changes I'm able to build against PostgresV16 but I'haven't tested it with prior postgres versions.

@dvv
Copy link

dvv commented Nov 26, 2023

@BenjaminLoesch would you push the changes to your fork so we could move on with this package?

@lacanoid
Copy link

Adding -Wno-int-conversion to PG_CPPFLAGS in the Makefile also fixes the compile problem

@dvv
Copy link

dvv commented Nov 30, 2023

@lacanoid thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants