EnterpriseDB / mongo_fdw

PostgreSQL foreign data wrapper for MongoDB
GNU Lesser General Public License v3.0
330 stars 70 forks source link

Issue with PostgreSQL 17 support #185

Open devrimgunduz opened 1 month ago

devrimgunduz commented 1 month ago

Hi,

5.5.2 fails to build against PostgreSQL 17 RC1. Log is attached. Please note that some of them are probably GCC 14 warnings that may need to be fixed.

mongo_fdw-5.5.2-pg17-build-error.txt

GA is due soon. Can you please take a look? Thanks!

Regards, Devrim

vaibhavdalvi93 commented 1 month ago

@devrimgunduz , It will be good if you could please let us know more details:

  1. Full build log report. Looks like you have shared only errors and warnings.
  2. Specific platform i.e. OS and its version
  3. These warnings occur only when compiled using GCC-14 or older versions of GCC as well
  4. The PostgreSQL installed via package or from source
  5. Only PG17 has these warnings, or back-branches as well

We're unable to reproduce reported warnings at our end. So, these above details may help us to get reported warnings and fix them. Thanks.

vaibhavdalvi93 commented 1 month ago

Thanks, @devrimgunduz for reporting an issue.

We're suspecting that following file is missing from your json-c directory(which resided in _mongofdw root directory):

json-c/json_util.c

We have tried to compile the source code by removing this file and resulting in a same reported error, i.e.

(make: *** No rule to make target 'json-c/json_util.o', needed by 'mongo_fdw.so'. Stop.)

Also, will it be possible for you to tell that how you downloaded the JSON-C source code? Whether the script autogen.sh is being used or it's been downloaded manually?

There may be another possibilities for this build failure but this is our primary suspicion.

Thanks & Regards, Vaibhav

vaibhavdalvi93 commented 1 month ago

We have tried to compile PG17 and mongofdw using GCC-14 and with compilation flag -Wmaybe-uninitialized_ on Ubuntu 24.04.

configure: using compiler=gcc (Ubuntu 14-20240412-0ubuntu1) 14.0.1 20240412 (experimental) [master r14-9935-g67e1433a94f] configure: using CFLAGS=-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 -O0 -Wmaybe-uninitialized.

Still, we're unable to reproduce the issue you have reported here. May be this is platform specific?

devrimgunduz commented 1 month ago

I think you need to scroll down a bit more for the actual error. The most important ones is the ones at the last part of the text. See the lines around create_foreignscan_path()

This function was changed since the beta version you last released mongo_fdw. You will need something like this patch:

https://github.com/tds-fdw/tds_fdw/commit/a694e823f3df2a3fd8f56744461ea4fe4338d8ea

or:

https://git.postgresql.org/gitweb/?p=pgrpms.git;a=blob;f=rpm/redhat/main/non-common/sqlite_fdw/main/sqlite_fdw-pg17.patch;h=0fa10841268bdbdccc02bc488b57bcfb6573803c;hb=HEAD

I'm not a hacker, so ignore me if I am wrong.

FWIW this is the spec file that I use:

https://git.postgresql.org/gitweb/?p=pgrpms.git;a=blob_plain;f=rpm/redhat/main/non-common/mongo_fdw/main/mongo_fdw.spec;hb=HEAD

This is what I changed between 5.5.1 and 5.5.2:

https://git.postgresql.org/gitweb/?p=pgrpms.git;a=commitdiff;h=6c9be333116a94dd09c4a4642a9f2716aed532aa

I removed RHEL 7 bits, some llvm macros related to RPM builds and then also removed calls to autogen.sh.

jeevanchalke commented 1 month ago

Thank you @devrimgunduz

create_foreignscan_path() only complains about the uninitialized variable. We will definitely fix those warnings in the new release. However, it should not fail the build. We wonder why it is failing for you. There is NO specific error in the log you have shared.

BTW, the changes you are suggesting are already part of the below commit: 11921b3 - Add support for PostgreSQL 17 and EDB Postgres Advanced Server 17. Without these changes, it won't compile on any of the platforms due to function signature changes.

My guess is that since you have removed the calls to autogen.sh, json-c files are not copied and compiled which are required for the compilation of mongo_fdw. See the Makefile for the reference.

Can you please check your setup by re-adding the autogen.sh.

Thanks