Skip to content

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

Open
chenjinbao1989 wants to merge 2 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 2 commits into
apache:mainfrom
chenjinbao1989:fix_pg16

Conversation

@chenjinbao1989

@chenjinbao1989 chenjinbao1989 commented Jul 7, 2026

Copy link
Copy Markdown

Summary

  • Build the native PXF extensions with both Cloudberry 2.x (PostgreSQL 14) and Cloudberry main (PostgreSQL 16).
  • Use Node * for makeString() results so the same source works before and after PostgreSQL split the Value node types.
  • Include <arpa/inet.h> for htonl(), ntohl(), htons(), and ntohs() declarations.
  • Add a Rocky 9 RPM compatibility matrix for REL_2_STABLE and main.
  • Scope RPM caches and artifacts by Cloudberry ref and commit, then verify the installed PostgreSQL major version before building PXF.
  • Force clean native builds in the testcontainer workspace to avoid reusing incompatible host objects.

Why

PostgreSQL 15 replaced the generic Value string node with String. Cloudberry 2.x still uses the older API, while Cloudberry main uses the newer API. Using the common Node base type keeps one PXF source tree compatible with both.

Cloudberry CI packages currently use the synthetic package version 99.0.0, so the package version alone cannot identify the source branch. The build ref, commit, and expected PostgreSQL major version are now carried with the RPM artifact and checked during installation.

Validation

  • external-table and fdw build successfully against a local Cloudberry 3.0.0-devel / PostgreSQL 16.9 installation.
  • CI builds and checks both REL_2_STABLE and main RPMs independently.

@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.

Comment thread .github/workflows/pxf-ci.yml Outdated
chenjinbao1989 and others added 2 commits September 3, 2026 15:57
Use Node pointers for makeString results so the same source compiles with both the legacy Value return type and the newer String return type. Include arpa/inet.h for the byte-order helpers.
Build Rocky 9 RPMs for both Cloudberry branches using ref- and commit-scoped caches. Record package provenance, verify the installed PostgreSQL major version, and force clean native builds in copied test workspaces.
@MisterRaindrop

Copy link
Copy Markdown
Collaborator

Updated the PR:

  • Replaced version-specific Value * / String * declarations with Node * casts, including pxfprotocol_test.c.
  • Kept one source tree compatible with Cloudberry 2.x and main.
  • Added a REL_2_STABLE / main RPM matrix with ref- and commit-scoped artifacts.
  • Added installed-version checks before building PXF.

Verified in CI run 33731109264:

  • REL_2_STABLE: PostgreSQL 14.9 / Cloudberry 2.2.0-incubating
  • main: PostgreSQL 16.9 / Cloudberry 3.0.0-devel

Both native-extension build jobs passed.

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