ildus / clickhouse_fdw

ClickHouse FDW for PostgreSQL
Apache License 2.0
260 stars 55 forks source link

PostgreSQL 17 support #109

Open crunchyjohn opened 2 months ago

crunchyjohn commented 2 months ago

Hello!

I would like to request pg17 support for clickhouse_fdw.

When I build against PG17 using the latest released version (1.4.0), I get the following error:

[ 85%] Building C object src/CMakeFiles/clickhouse_fdw.dir/connection.c.o
<SNIP>
clickhouse_fdw/src/clickhouse_fdw.c: In function 'clickhouseGetForeignPaths':
clickhouse_fdw/src/clickhouse_fdw.c:514:15: error: too few arguments to function 'create_foreignscan_path'
  514 |         path= create_foreignscan_path(root, baserel, NULL,
      |               ^~~~~~~~~~~~~~~~~~~~~~~
In file included from clickhouse_fdw/src/clickhouse_fdw.c:32:
/usr/pgsql-17/include/server/optimizer/pathnode.h:125:21: note: declared here
  125 | extern ForeignPath *create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel,
      |                     ^~~~~~~~~~~~~~~~~~~~~~~
clickhouse_fdw/src/clickhouse_fdw.c: In function 'clickhouseBeginForeignScan':
clickhouse_fdw/src/clickhouse_fdw.c:771:21: error: 'RangeTblEntry' has no member named 'checkAsUser'
  771 |         userid = rte->checkAsUser ? rte->checkAsUser : GetUserId();
      |                     ^~
clickhouse_fdw/src/clickhouse_fdw.c:771:40: error: 'RangeTblEntry' has no member named 'checkAsUser'
  771 |         userid = rte->checkAsUser ? rte->checkAsUser : GetUserId();
      |                                        ^~
clickhouse_fdw/src/clickhouse_fdw.c: In function 'create_foreign_modify':
clickhouse_fdw/src/clickhouse_fdw.c:1380:21: error: 'RangeTblEntry' has no member named 'checkAsUser'
 1380 |         userid = rte->checkAsUser ? rte->checkAsUser : GetUserId();
      |                     ^~
clickhouse_fdw/src/clickhouse_fdw.c:1380:40: error: 'RangeTblEntry' has no member named 'checkAsUser'
 1380 |         userid = rte->checkAsUser ? rte->checkAsUser : GetUserId();
      |                                        ^~
clickhouse_fdw/src/clickhouse_fdw.c: In function 'add_paths_with_pathkeys_for_rel':
clickhouse_fdw/src/clickhouse_fdw.c:1842:42: error: too few arguments to function 'create_foreignscan_path'
 1842 |                                          create_foreignscan_path(root, rel,
      |                                          ^~~~~~~~~~~~~~~~~~~~~~~
<SNIP... but there are more errors>
make: *** [Makefile:136: all] Error 2

I am compling on an Alma9 - x86_64 Linux box. I am unsure what changes would be required, so I thought I would raise the issue.

Thanks!

akileebyines commented 1 month ago

Hello, having a similar set of troubles when compiling on a ubuntu22.04 for PostgreSQL 17

`[ 47%] Building C object src/CMakeFiles/clickhouse_fdw.dir/clickhouse_fdw.c.o cc1: warning: ‘-fstack-check=’ and ‘-fstack-clash_protection’ are mutually exclusive; disabling ‘-fstack-check=’ In file included from clickhouse_fdw-master/src/clickhouse_fdw.c:38: clickhouse_fdw-master/src/clickhouse_fdw.c: In function ‘clickhousedb_raw_query’: /usr/include/postgresql/17/server/fmgr.h:332:50: warning: passing argument 1 of ‘DatumGetPointer’ makes integer from pointer without a cast [-Wint-conversion] 332 #define DatumGetTextP(X) ((text *) PG_DETOAST_DATUM(X)) ~^~~~~~~~~
text {aka struct varlena }
/usr/include/postgresql/17/server/utils/builtins.h:98:73: note: in definition of macro ‘TextDatumGetCString’ 98 #define TextDatumGetCString(d) text_to_cstring((text *) DatumGetPointer(d)) ^ /usr/include/postgresql/17/server/fmgr.h:336:49: note: in expansion of macro ‘DatumGetTextP’ 336 #define PG_GETARG_TEXT_P(n) DatumGetTextP(PG_GETARG_DATUM(n)) ^~~~~ clickhouse_fdw-master/src/clickhouse_fdw.c:299:48: note: in expansion of macro ‘PG_GETARG_TEXT_P’ 299 char *connstring = TextDatumGetCString(PG_GETARG_TEXT_P(1)), ^~~~ In file included from clickhouse_fdw-master/src/clickhouse_fdw.c:14: /usr/include/postgresql/17/server/postgres.h:312:23: note: expected ‘Datum’ {aka ‘long unsigned int’} but argument is of type ‘text ’ {aka ‘struct varlena ’} 312 DatumGetPointer(Datum X) ~~^ In file included from clickhouse_fdw-master/src/clickhouse_fdw.c:38: /usr/include/postgresql/17/server/fmgr.h:332:50: warning: passing argument 1 of ‘DatumGetPointer’ makes integer from pointer without a cast [-Wint-conversion] 332 #define DatumGetTextP(X) ((text *) PG_DETOAST_DATUM(X)) ~^~~~~~~~~
text {aka struct varlena }

/usr/include/postgresql/17/server/utils/builtins.h:98:73: note: in definition of macro ‘TextDatumGetCString’ 98 | #define TextDatumGetCString(d) text_to_cstring((text ) DatumGetPointer(d)) | ^ /usr/include/postgresql/17/server/fmgr.h:336:49: note: in expansion of macro ‘DatumGetTextP’ 336 | #define PG_GETARG_TEXT_P(n) DatumGetTextP(PG_GETARG_DATUM(n)) | ^~~~~ clickhouse_fdw-master/src/clickhouse_fdw.c:300:47: note: in expansion of macro ‘PG_GETARG_TEXT_P’ 300 | query = TextDatumGetCString(PG_GETARG_TEXT_P(0)); | ^~~~ In file included from clickhouse_fdw-master/src/clickhouse_fdw.c:14: /usr/include/postgresql/17/server/postgres.h:312:23: note: expected ‘Datum’ {aka ‘long unsigned int’} but argument is of type ‘text ’ {aka ‘struct varlena ’} 312 | DatumGetPointer(Datum X) | ~~^ clickhouse_fdw-master/src/clickhouse_fdw.c: In function ‘clickhouseGetForeignPaths’: clickhouse_fdw-master/src/clickhouse_fdw.c:514:15: error: too few arguments to function ‘create_foreignscan_path’ 514 | path= create_foreignscan_path(root, baserel, NULL, | ^~~~~~~ In file included from clickhouse_fdw-master/src/clickhouse_fdw.c:32: /usr/include/postgresql/17/server/optimizer/pathnode.h:125:21: note: declared here 125 | extern ForeignPath create_foreignscan_path(PlannerInfo root, RelOptInfo rel, | ^~~~~~~ clickhouse_fdw-master/src/clickhouse_fdw.c: In function ‘add_paths_with_pathkeys_for_rel’: clickhouse_fdw-master/src/clickhouse_fdw.c:1850:42: error: too few arguments to function ‘create_foreignscan_path’ 1850 | create_foreignscan_path(root, rel, | ^~~~~~~ In file included from clickhouse_fdw-master/src/clickhouse_fdw.c:32: /usr/include/postgresql/17/server/optimizer/pathnode.h:125:21: note: declared here 125 | extern ForeignPath create_foreignscan_path(PlannerInfo root, RelOptInfo rel, | ^~~~~~~ clickhouse_fdw-master/src/clickhouse_fdw.c:1861:42: error: too few arguments to function ‘create_foreign_join_path’ 1861 | create_foreign_join_path(root, rel, | ^~~~~~~~ In file included from clickhouse_fdw-master/src/clickhouse_fdw.c:32: /usr/include/postgresql/17/server/optimizer/pathnode.h:133:21: note: declared here 133 | extern ForeignPath create_foreign_join_path(PlannerInfo root, RelOptInfo rel, | ^~~~~~~~ clickhouse_fdw-master/src/clickhouse_fdw.c: In function ‘clickhouseGetForeignJoinPaths’: clickhouse_fdw-master/src/clickhouse_fdw.c:2019:20: error: too few arguments to function ‘create_foreign_join_path’ 2019 | joinpath = create_foreign_join_path(root, | ^~~~~~~~ In file included from clickhouse_fdw-master/src/clickhouse_fdw.c:32: /usr/include/postgresql/17/server/optimizer/pathnode.h:133:21: note: declared here 133 | extern ForeignPath create_foreign_join_path(PlannerInfo root, RelOptInfo rel, | ^~~~~~~~ clickhouse_fdw-master/src/clickhouse_fdw.c: In function ‘add_foreign_grouping_paths’: clickhouse_fdw-master/src/clickhouse_fdw.c:2390:21: error: too few arguments to function ‘create_foreign_upper_path’ 2390 | grouppath = create_foreign_upper_path(root, | ^~~~~~~~~ In file included from clickhouse_fdw-master/src/clickhouse_fdw.c:32: /usr/include/postgresql/17/server/optimizer/pathnode.h:141:21: note: declared here 141 | extern ForeignPath create_foreign_upper_path(PlannerInfo root, RelOptInfo rel, | ^~~~~~~~~ clickhouse_fdw-master/src/clickhouse_fdw.c: In function ‘add_foreign_ordered_paths’: clickhouse_fdw-master/src/clickhouse_fdw.c:2528:24: error: too few arguments to function ‘create_foreign_upper_path’ 2528 | ordered_path = create_foreign_upper_path(root, | ^~~~~~~~~ In file included from clickhouse_fdw-master/src/clickhouse_fdw.c:32: /usr/include/postgresql/17/server/optimizer/pathnode.h:141:21: note: declared here 141 | extern ForeignPath create_foreign_upper_path(PlannerInfo root, RelOptInfo rel, | ^~~~~~~~~ clickhouse_fdw-master/src/clickhouse_fdw.c: In function ‘add_foreign_final_paths’: clickhouse_fdw-master/src/clickhouse_fdw.c:2673:22: error: too few arguments to function ‘create_foreign_upper_path’ 2673 | final_path = create_foreign_upper_path(root, | ^~~~~~~~~ In file included from clickhouse_fdw-master/src/clickhouse_fdw.c:32: /usr/include/postgresql/17/server/optimizer/pathnode.h:141:21: note: declared here 141 | extern ForeignPath create_foreign_upper_path(PlannerInfo root, RelOptInfo *rel, | ^~~~~~~~~ make[2]: [src/CMakeFiles/clickhouse_fdw.dir/build.make:76: src/CMakeFiles/clickhouse_fdw.dir/clickhouse_fdw.c.o] Error 1 make[1]: [CMakeFiles/Makefile2:200: src/CMakeFiles/clickhouse_fdw.dir/all] Error 2 make: *** [Makefile:136: all] Error 2 `