laurenz / oracle_fdw

PostgreSQL Foreign Data Wrapper for Oracle
http://laurenz.github.io/oracle_fdw/
Other
496 stars 156 forks source link

Error in MAKE oracle_fdw on debian bullseye-slim #612

Closed stefanomusso70 closed 1 year ago

stefanomusso70 commented 1 year ago

Hi Lorentz, I attempted to install oracle_fdw on a debian bullseye-slim system. The release of oracle-fdw is 2.3.0, the Oracle instant client is 21.1, the release of postgres is 13.12-1.pgdg110+1, the prerequisites have been met.

First I try to build a docker image based on bullseye-slim with postgres and oracle_fdw, but I have an error. So I try to do the make inside the container (based on a image with postgres) and not during the build of the image, but I have always the same error:

root@0993abe2eabe:/tmp/oracle_fdw-ORACLE_FDW_2_3_0# make
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -fPIC -fvisibility=hidden -I/tmp/instantclient_21_1/sdk/include -I/tmp/instantclient_21_1/oci/include -I/tmp/instantclient_21_1/rdbms/public -I/tmp/instantclient_21_1 -I/usr/include/oracle/19.8/client -I/usr/include/oracle/19.8/client64 -I/usr/include/oracle/19.6/client -I/usr/include/oracle/19.6/client64 -I/usr/include/oracle/19.3/client -I/usr/include/oracle/19.3/client64 -I/usr/include/oracle/18.5/client -I/usr/include/oracle/18.5/client64 -I/usr/include/oracle/18.3/client -I/usr/include/oracle/18.3/client64 -I/usr/include/oracle/12.2/client -I/usr/include/oracle/12.2/client64 -I/usr/include/oracle/12.1/client -I/usr/include/oracle/12.1/client64 -I/usr/include/oracle/11.2/client -I/usr/include/oracle/11.2/client64 -I/usr/include/oracle/11.1/client -I/usr/include/oracle/11.1/client64 -I/usr/include/oracle/10.2.0.5/client -I/usr/include/oracle/10.2.0.5/client64 -I/usr/include/oracle/10.2.0.4/client -I/usr/include/oracle/10.2.0.4/client64 -I/usr/include/oracle/10.2.0.3/client -I/usr/include/oracle/10.2.0.3/client64 -I. -I./ -I/usr/include/postgresql/16/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2   -c -o oracle_fdw.o oracle_fdw.c
oracle_fdw.c: In function ‘oracle_fdw_handler’:
oracle_fdw.c:400:38: warning: assignment to ‘AddForeignUpdateTargets_function’ {aka ‘void (*)(PlannerInfo *, unsigned int,  RangeTblEntry *, struct RelationData *)’} from incompatible pointer type ‘void (*)(Query *, RangeTblEntry *, struct RelationData *)’ [-Wincompatible-pointer-types]
  400 |  fdwroutine->AddForeignUpdateTargets = oracleAddForeignUpdateTargets;
      |                                      ^
oracle_fdw.c: In function ‘oracle_fdw_validator’:
oracle_fdw.c:478:30: error: ‘Value’ undeclared (first use in this function)
  478 |    (void)getIsolationLevel(((Value *)(def->arg))->val.str);
      |                              ^~~~~
oracle_fdw.c:478:30: note: each undeclared identifier is reported only once for each function it appears in
oracle_fdw.c:478:37: error: expected expression before ‘)’ token
  478 |    (void)getIsolationLevel(((Value *)(def->arg))->val.str);
      |                                     ^
oracle_fdw.c:486:25: error: expected expression before ‘)’ token
  486 |    char *val = ((Value *)(def->arg))->val.str;
      |                         ^
oracle_fdw.c:502:25: error: expected expression before ‘)’ token
  502 |    char *val = ((Value *)(def->arg))->val.str;
      |                         ^
.
.
.
oracle_fdw.c:5096:24: error: expected expression before ‘)’ token
 5096 |    nls_lang = ((Value *) (def->arg))->val.str;
      |                        ^
oracle_fdw.c:5098:24: error: expected expression before ‘)’ token
 5098 |    dbserver = ((Value *) (def->arg))->val.str;
      |                        ^
oracle_fdw.c:5100:48: error: expected expression before ‘)’ token
 5100 |   isolation_level = getIsolationLevel(((Value *) (def->arg))->val.str);
      |                                                ^
oracle_fdw.c:5102:20: error: expected expression before ‘)’ token
 5102 |    user = ((Value *) (def->arg))->val.str;
      |                    ^
oracle_fdw.c:5104:24: error: expected expression before ‘)’ token
 5104 |    password = ((Value *) (def->arg))->val.str;
      |                        ^
oracle_fdw.c: In function ‘deparseInterval’:
oracle_fdw.c:5519:6: warning: implicit declaration of function ‘interval2tm’; did you mean ‘interval2itm’? [-Wimplicit-function-declaration]
 5519 |  if (interval2tm(*DatumGetIntervalP(datum), &tm, &fsec) != 0)
      |      ^~~~~~~~~~~
      |      interval2itm
make: *** [<builtin>: oracle_fdw.o] Error 1
root@0993abe2eabe:/tmp/oracle_fdw-ORACLE_FDW_2_3_0# 

With oracle_fdw 2.4.0 I have the same error.

With oracle_fdw 2.5.0 I have different error:

root@0993abe2eabe:/tmp/oracle_fdw-2.5.0# make
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -fPIC -fvisibility=hidden -I"/tmp/instantclient_21_1/sdk/include" -I"/tmp/instantclient_21_1/oci/include" -I"/tmp/instantclient_21_1/rdbms/public" -I"/tmp/instantclient_21_1/"  -I. -I./ -I/usr/include/postgresql/16/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2   -c -o oracle_fdw.o oracle_fdw.c
oracle_fdw.c: In function ‘oracleGetForeignRelSize’:
oracle_fdw.c:782:50: error: ‘RangeTblEntry’ has no member named ‘checkAsUser’
  782 |  fdwState = getFdwState(foreigntableid, NULL, rte->checkAsUser);
      |                                                  ^~
oracle_fdw.c: In function ‘oraclePlanForeignModify’:
oracle_fdw.c:1546:47: error: ‘RangeTblEntry’ has no member named ‘checkAsUser’
 1546 |   fdwState = getFdwState(rte->relid, NULL, rte->checkAsUser);
      |                                               ^~
oracle_fdw.c:1585:25: error: ‘RangeTblEntry’ has no member named ‘updatedCols’
 1585 |    tmpset = bms_copy(rte->updatedCols);
      |                         ^~
oracle_fdw.c:1590:18: warning: implicit declaration of function ‘bms_first_member’; did you mean ‘bms_is_member’? [-Wimplicit-function-declaration]
 1590 |    while ((col = bms_first_member(tmpset)) >= 0)
      |                  ^~~~~~~~~~~~~~~~
      |                  bms_is_member
oracle_fdw.c: In function ‘oracleBeginForeignInsert’:
oracle_fdw.c:1867:58: error: ‘RangeTblEntry’ has no member named ‘checkAsUser’
 1867 |  fdw_state = getFdwState(RelationGetRelid(rel), NULL, rte->checkAsUser);
      |                                                          ^~
make: *** [<builtin>: oracle_fdw.o] Error 1
root@0993abe2eabe:/tmp/oracle_fdw-2.5.0# 

For me the better solution is installing 2.3.0 release.

laurenz commented 1 year ago

Concerning your attempt to build release 2.3.0 with PostgreSQL v13:

You aren't actually building against PostgreSQL v13. See the following in your compiler invocation:

gcc [...] -I/usr/include/postgresql/16/server -I/usr/include/postgresql/internal [...] oracle_fdw.c

It seems like the first pg_config on your PATH is from a PostgreSQL v16 installation. It is to be expected that building oracle_fdw 2.3.0 with PostgreSQL v16 will fail.

You have to change PATH so that pg_config from your PostgreSQL v13 installation is first on the path:

PATH=/path/to/pg13/bin:$PATH make

Your second build attempt fails for the very same reason: release 2.5.0 also doesn't work with PostgreSQL v16. The error messages are different, because the incompatibilities are different.

My advice is to always use the latest release of oracle_fdw, no matter against which version of PostgreSQL you are building.

laurenz commented 1 year ago

Anything else I can help you with, or can we close this issue?

stefanomusso70 commented 1 year ago

Thank you, with your suggestion I solve the problem, I can close the issue. Bye Stefano