Skip to content

[Bug] Compilation Failure in pxf_fdw Due to PG_VERSION_NUM Update and --enable-pxf Option #583

@edespino

Description

@edespino

Cloudberry Database version

HEAD of main

What happened

While building Cloudberry Database with the --enable-pxf configure option, I encountered a compilation failure in the pxf_fdw module. The issue appears to be related to the recent update of PG_VERSION_NUM to 140004, reflecting the upgrade to PostgreSQL 14.4, rather than the Cloudberry Database version itself.

The problem is caused by conditional preprocessor directives that depend on PG_VERSION_NUM, leading to different compilation paths. For example, in pxf_fragment.c, a necessary header file is no longer included due to the updated version number:

#if (PG_VERSION_NUM <= 140000)
#include "commands/copyfrom_internal.h"
#endif

Compilation Error:
The error occurs during the compilation of the ProcessRequest function within pxf_fragment.c:

gcc -Wall -Wmissing-prototypes -Wpointer-arith -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-unused-but-set-variable -Werror=implicit-fallthrough=3 -Wno-format-truncation -Wno-stringop-truncation -O3 -fPIC  -DUSE_INTERNAL_FTS=1  -Werror=uninitialized -Werror=implicit-function-declaration -Werror -fPIC -I. -I. -I../../src/include   -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/local/cloudberry/include  -c -o pxf_fragment.o pxf_fragment.c
pxf_fragment.c: In function ‘ProcessRequest’:
pxf_fragment.c:547:15: error: ‘RAW_BUF_SIZE’ undeclared (first use in this function); did you mean ‘BUFSIZ’?
  char  buffer[RAW_BUF_SIZE];
               ^~~~~~~~~~~~
               BUFSIZ
pxf_fragment.c:547:15: note: each undeclared identifier is reported only once for each function it appears in
pxf_fragment.c:547:8: error: unused variable ‘buffer’ [-Werror=unused-variable]
  char  buffer[RAW_BUF_SIZE];
        ^~~~~~
cc1: all warnings being treated as errors

What you think should happen instead

No response

How to reproduce

Steps to Reproduce:

  1. Change Cloudberry Database version to 1.5.4 in configure.ac
  2. Run autoconf to regenerate the configure script
  3. Run configure with the --enable-pxf option
  4. Compile the code.

Operating System

Rocky Linux 9.4 (this issue is not OS dependent)

Anything else

Expected Outcome:
The code should compile without errors.

Actual Outcome:
The compilation fails with the errors mentioned above.

Additional Information:
The issue stems from the changes in PG_VERSION_NUM and its impact on conditional preprocessor logic. The recent update to PostgreSQL 14.4 has introduced new conditions that were not present in earlier versions, leading to this failure.

This is a critical issue that needs to be addressed so we can include the --enable-pxf feature for our next open source build.

Are you willing to submit PR?

  • Yes, I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Labels

type: BugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions