Skip to content

Fix build against PG16 headers: Value node removal and missing htonl decl#123

Open
chenjinbao1989 wants to merge 3 commits into
apache:mainfrom
chenjinbao1989:fix_pg16
Open

Fix build against PG16 headers: Value node removal and missing htonl decl#123
chenjinbao1989 wants to merge 3 commits into
apache:mainfrom
chenjinbao1989:fix_pg16

Conversation

@chenjinbao1989

Copy link
Copy Markdown

pxfuriparser.c and pxf_option.c used the generic Value node type for option-name strings; PG16 split Value into distinct Integer/Float/String/ etc. node types, and makeString()/strVal() now operate on String *, so these failed to compile with "unknown type name 'Value'".

gpdbwritableformatter.c called htonl/ntohl/htons/ntohs without including arpa/inet.h. This used to be a silent implicit-declaration warning but is a hard error under GCC 13's -Werror=implicit-function-declaration.

closes: #ISSUE_Number


Change logs

Describe your change clearly, including what problem is being solved or what document is being added or updated.

Contributor's checklist

Here are some reminders before you submit your pull request:

…decl

pxfuriparser.c and pxf_option.c used the generic Value node type for
option-name strings; PG16 split Value into distinct Integer/Float/String/
etc. node types, and makeString()/strVal() now operate on String *, so
these failed to compile with "unknown type name 'Value'".

gpdbwritableformatter.c called htonl/ntohl/htons/ntohs without including
arpa/inet.h. This used to be a silent implicit-declaration warning but is
a hard error under GCC 13's -Werror=implicit-function-declaration.
@ostinru ostinru requested a review from MisterRaindrop July 7, 2026 18:21
@ostinru

ostinru commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Compilation with cloudberry 2.x got broken. e.g. in Test PXF - fdw

pxf_option.c:473:25: error: unknown type name ‘String’
  473 |                         String     *val = makeString(def->defname);
      |                         ^~~~~~
pxf_option.c:473:43: warning: initialization of ‘int *’ from incompatible pointer type ‘Value *’ [-Wincompatible-pointer-types]
  473 |                         String     *val = makeString(def->defname);
      |                                           ^~~~~~~~~~
make: *** [<builtin>: pxf_option.o] Error 1

@ostinru ostinru added this to the v3.0 milestone Jul 7, 2026
@MisterRaindrop

Copy link
Copy Markdown
Collaborator

I see external-table/test/pxfprotocol_test.c file still use Value *v = makeString(uri_no_profile); need modify

@tuhaihe

tuhaihe commented Jul 8, 2026

Copy link
Copy Markdown
Member

Besides the REL_2_STABLE branch, should we add Cloudberry main branch support to the CI workflow?

env:
JAVA_VERSION: "11"
JAVA_HOME: "/usr/lib/jvm/java-11-openjdk"
GO_VERSION: "1.25"
GPHOME: "/usr/local/cloudberry-db"
CLOUDBERRY_VERSION: "REL_2_STABLE"
PXF_HOME: "/usr/local/pxf"

Then we can verify if the changes work, right?

@ostinru

ostinru commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

I think that we can support cloudberry 2.x and 3.x in a single cloudberry-pxf codebase with some #ifdefs on C-lang side. This will allow us to compile and use cloudberry-pxf-3.x with cloudberry-2.x. This way we will avoid supporting multiple branches.

pxfuriparser.c and pxf_option.c hardcoded the PG16 String node type,
which broke compilation against Cloudberry builds still on a pre-16
Postgres base (e.g. the PG14-based cbdb-build-ubuntu22.04 image used by
the testcontainers automation suite, which still uses the old generic
Value node). Replaced with a PG_VERSION_NUM-gated typedef so the same
source compiles against both.

build_pxf.sh: the testcontainers harness copies the entire host repo
(including any binaries the host already built) into the test
container, so a plain `make install` for the native external-table/fdw
extensions could silently reuse a .so built for a different Postgres
base or glibc instead of rebuilding for the container's own toolchain.
Added `clean` before `install`, and `set -euo pipefail` so a real build
failure fails loudly instead of being silently swallowed (this is how
the resulting "pxf.control missing" error went undetected).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants