ildus / clickhouse_fdw

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

Postgresql 14 support #78

Closed stsimb closed 2 years ago

stsimb commented 2 years ago

Hi,

Trying to build clickhouse_fdw 1.3.0 against postgresql-14 I get the following error. Could someone please have a look?

[root@archimedes build]# cmake ..
-- The C compiler identification is GNU 8.3.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/rh/devtoolset-8/root/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Setting clickhouse_fdw build type -
-- The CXX compiler identification is GNU 8.3.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/rh/devtoolset-8/root/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /bin/pkg-config (found version "0.27.1")
-- Checking for module 'libcurl'
--   Found libcurl, version 7.43.0
-- Checking for module 'uuid'
--   Found uuid, version 2.23.0
-- Configuring done
-- Generating done
-- Build files have been written to: /root/software/clickhouse_fdw-1.3.0/build
[root@archimedes build]# make
[  1%] Building C object src/clickhouse-cpp/contrib/lz4/CMakeFiles/lz4-lib.dir/lz4.c.o
[  2%] Building C object src/clickhouse-cpp/contrib/lz4/CMakeFiles/lz4-lib.dir/lz4hc.c.o
[  4%] Linking C static library liblz4-lib.a
[  4%] Built target lz4-lib
[  5%] Generating ../clickhouse_fdw--1.3.sql
[  5%] Built target clickhouse_fdw_sql
[  7%] Building CXX object src/clickhouse-cpp/contrib/cityhash/CMakeFiles/cityhash-lib.dir/city.cc.o
[  8%] Linking CXX static library libcityhash-lib.a
[  8%] Built target cityhash-lib
[ 10%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/base/coded.cpp.o
[ 11%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/base/compressed.cpp.o
[ 12%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/base/input.cpp.o
[ 14%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/base/output.cpp.o
[ 15%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/base/platform.cpp.o
[ 17%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/base/socket.cpp.o
[ 18%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/columns/array.cpp.o
[ 20%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/columns/date.cpp.o
[ 21%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/columns/decimal.cpp.o
[ 22%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/columns/enum.cpp.o
[ 24%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/columns/factory.cpp.o
[ 25%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/columns/ip4.cpp.o
[ 27%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/columns/ip6.cpp.o
[ 28%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/columns/lowcardinality.cpp.o
[ 30%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/columns/nullable.cpp.o
[ 31%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/columns/numeric.cpp.o
[ 32%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/columns/string.cpp.o
[ 34%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/columns/tuple.cpp.o
[ 35%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/columns/uuid.cpp.o
[ 37%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/columns/itemview.cpp.o
[ 38%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/types/type_parser.cpp.o
[ 40%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/types/types.cpp.o
[ 41%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/block.cpp.o
[ 42%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/client.cpp.o
[ 44%] Building CXX object src/clickhouse-cpp/clickhouse/CMakeFiles/clickhouse-cpp-lib-static.dir/query.cpp.o
[ 45%] Linking CXX static library libclickhouse-cpp-lib-static.a
[ 45%] Built target clickhouse-cpp-lib-static
[ 47%] Building C object src/CMakeFiles/clickhouse_fdw.dir/clickhouse_fdw.c.o
/root/software/clickhouse_fdw-1.3.0/src/clickhouse_fdw.c: In function ‘clickhouseBeginForeignModify’:
/root/software/clickhouse_fdw-1.3.0/src/clickhouse_fdw.c:1119:43: error: ‘ModifyTableState’ {aka ‘struct ModifyTableState’} has no member named ‘mt_plans’; did you mean ‘mt_done’?
                                  mtstate->mt_plans[subplan_index]->plan,
                                           ^~~~~~~~
                                           mt_done
/root/software/clickhouse_fdw-1.3.0/src/clickhouse_fdw.c: In function ‘foreign_grouping_ok’:
/root/software/clickhouse_fdw-1.3.0/src/clickhouse_fdw.c:2159:30: warning: passing argument 1 of ‘make_restrictinfo’ from incompatible pointer type [-Wincompatible-pointer-types]
    rinfo = make_restrictinfo(expr,
                              ^~~~
In file included from /root/software/clickhouse_fdw-1.3.0/src/clickhouse_fdw.c:32:
/usr/pgsql-14/include/server/optimizer/restrictinfo.h:24:22: note: expected ‘PlannerInfo *’ {aka ‘struct PlannerInfo *’} but argument is of type ‘Expr *’ {aka ‘struct Expr *’}
 extern RestrictInfo *make_restrictinfo(PlannerInfo *root,
                      ^~~~~~~~~~~~~~~~~
/root/software/clickhouse_fdw-1.3.0/src/clickhouse_fdw.c:2160:12: warning: passing argument 2 of ‘make_restrictinfo’ makes pointer from integer without a cast [-Wint-conversion]
            true,
            ^~~~
In file included from /root/software/clickhouse_fdw-1.3.0/src/clickhouse_fdw.c:32:
/usr/pgsql-14/include/server/optimizer/restrictinfo.h:24:22: note: expected ‘Expr *’ {aka ‘struct Expr *’} but argument is of type ‘int’
 extern RestrictInfo *make_restrictinfo(PlannerInfo *root,
                      ^~~~~~~~~~~~~~~~~
/root/software/clickhouse_fdw-1.3.0/src/clickhouse_fdw.c:2164:23: warning: passing argument 6 of ‘make_restrictinfo’ makes integer from pointer without a cast [-Wint-conversion]
            grouped_rel->relids,
            ~~~~~~~~~~~^~~~~~~~
In file included from /root/software/clickhouse_fdw-1.3.0/src/clickhouse_fdw.c:32:
/usr/pgsql-14/include/server/optimizer/restrictinfo.h:24:22: note: expected ‘Index’ {aka ‘unsigned int’} but argument is of type ‘Relids’ {aka ‘struct Bitmapset *’}
 extern RestrictInfo *make_restrictinfo(PlannerInfo *root,
                      ^~~~~~~~~~~~~~~~~
/root/software/clickhouse_fdw-1.3.0/src/clickhouse_fdw.c:2159:12: error: too few arguments to function ‘make_restrictinfo’
    rinfo = make_restrictinfo(expr,
            ^~~~~~~~~~~~~~~~~
In file included from /root/software/clickhouse_fdw-1.3.0/src/clickhouse_fdw.c:32:
/usr/pgsql-14/include/server/optimizer/restrictinfo.h:24:22: note: declared here
 extern RestrictInfo *make_restrictinfo(PlannerInfo *root,
                      ^~~~~~~~~~~~~~~~~
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

Using CentOS 7, scl enable devtoolset-8 and postgresql-14 from official pgdg repo.

[root@archimedes build]# pg_config
BINDIR = /usr/pgsql-14/bin
DOCDIR = /usr/pgsql-14/doc
HTMLDIR = /usr/pgsql-14/doc/html
INCLUDEDIR = /usr/pgsql-14/include
PKGINCLUDEDIR = /usr/pgsql-14/include
INCLUDEDIR-SERVER = /usr/pgsql-14/include/server
LIBDIR = /usr/pgsql-14/lib
PKGLIBDIR = /usr/pgsql-14/lib
LOCALEDIR = /usr/pgsql-14/share/locale
MANDIR = /usr/pgsql-14/share/man
SHAREDIR = /usr/pgsql-14/share
SYSCONFDIR = /etc/sysconfig/pgsql
PGXS = /usr/pgsql-14/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE =  '--enable-rpath' '--prefix=/usr/pgsql-14' '--includedir=/usr/pgsql-14/include' '--mandir=/usr/pgsql-14/share/man' '--datadir=/usr/pgsql-14/share' '--libdir=/usr/pgsql-14/lib' '--with-lz4' '--with-icu' '--with-llvm' '--with-perl' '--with-python' '--with-tcl' '--with-tclconfig=/usr/lib64' '--with-openssl' '--with-pam' '--with-gssapi' '--with-includes=/usr/include' '--with-libraries=/usr/lib64' '--enable-nls' '--enable-dtrace' '--with-uuid=e2fs' '--with-libxml' '--with-libxslt' '--with-ldap' '--with-selinux' '--with-systemd' '--with-system-tzdata=/usr/share/zoneinfo' '--sysconfdir=/etc/sysconfig/pgsql' '--docdir=/usr/pgsql-14/doc' '--htmldir=/usr/pgsql-14/doc/html' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic' 'LLVM_CONFIG=/usr/lib64/llvm5.0/bin/llvm-config' 'CLANG=/opt/rh/llvm-toolset-7/root/usr/bin/clang' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig' 'PYTHON=/usr/bin/python3'
CC = gcc -std=gnu99
CPPFLAGS = -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic
CFLAGS_SL = -fPIC
LDFLAGS = -L/usr/lib64/llvm5.0/lib -L/usr/lib64 -Wl,--as-needed -Wl,-rpath,'/usr/pgsql-14/lib',--enable-new-dtags
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgcommon -lpgport -lselinux -llz4 -lxslt -lxml2 -lpam -lssl -lcrypto -lgssapi_krb5 -lz -lreadline -lpthread -lrt -ldl -lm
VERSION = PostgreSQL 14.1
maxpain commented 2 years ago

The same problem

sakutepov commented 2 years ago

Supported PostgreSQL Versions

PostgreSQL 11-13

stsimb commented 2 years ago

Supported PostgreSQL Versions

PostgreSQL 11-13

We know, but postgresql-14 has benefits that we'd like to take advantage of, but we also need clickhouse_fdw ...

Denchick commented 2 years ago

I think I fixed it, at least the tests for pg14 passed. See #80 and #79.

stsimb commented 2 years ago

Closing this issue, https://github.com/adjust/clickhouse_fdw/pull/79 has been merged :-)