Skip to content

pg_duckdb: ship libduckdb.so once as a shared pgedge-libduckdb package - #79

Closed
maqeel75 wants to merge 1 commit into
mainfrom
shared-libduckdb
Closed

pg_duckdb: ship libduckdb.so once as a shared pgedge-libduckdb package#79
maqeel75 wants to merge 1 commit into
mainfrom
shared-libduckdb

Conversation

@maqeel75

Copy link
Copy Markdown
Member

Summary

libduckdb.so is DuckDB itself, built from pg_duckdb's third_party/duckdb submodule and shipped by every per-major package. Nothing in it is PostgreSQL-specific (.text/.rodata are bit-identical across PG 16/17/18), so all three packages
carried the same binary with the same build-id — and each claimed /usr/lib/.build-id/<xx>/<hash> pointing at its own PG libdir. rpm's transaction test and dpkg both reject that, so installing pg16+pg17+pg18 side by side failed:

file /usr/lib/.build-id/e1/357265... conflicts between attempted installs of
pgedge-pg-duckdb_16 and pgedge-pg-duckdb_17

It only appeared to work on el10/Ubuntu, where an accidental per-major RUNPATH changed the build-id.

The engine now ships once as pgedge-libduckdb into /usr/lib/pgedge/coldfront/libduckdb, alongside the duckdb extensions. pg_duckdb.so finds it via an RPATH appended to SHLIB_LINK at build time (no symlinks, no patchelf), and the
per-major packages contain only the extension.

  • Only the latest major builds it — each major is a separate build, and emitting it from several would push same-version artifacts that reprepro rejects. That major is read from release.yml's pg_versions, so it advances on its own.
  • Dependency is pinned by engine version, not NVR (= 1.5.4 / >= 1.5.4~, << 1.5.5~), so one major can be rebuilt at a higher buildnum while 1.5.4 never pairs with 1.5.5 across the C++ ABI.
  • Also fixes bogus date in %changelog weekdays in three specs.

Verified in containers on almalinux:9 and debian:trixie with real spec/debian/rules and stubbed compile, against the live release repo: main's packaging reproduces the conflict, this branch installs all majors + engine cleanly, and ldd
resolves the engine through the RPATH. Real published binaries confirm the RUNPATH is present on both distros.

@maqeel75
maqeel75 requested a review from vyruss as a code owner August 20, 2026 14:29
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 90a06e0c-67d7-4f84-a553-05f0d3b18d61

📥 Commits

Reviewing files that changed from the base of the PR and between 26a8130 and 8176883.

📒 Files selected for processing (11)
  • packaging/coldfront-duckdb-extensions/rpm/coldfront-duckdb-extensions.spec
  • packaging/coldfront/rpm/coldfront.spec
  • packaging/pg_duckdb/build-deb.sh
  • packaging/pg_duckdb/build-rpm.sh
  • packaging/pg_duckdb/common.sh
  • packaging/pg_duckdb/deb/debian/control.in
  • packaging/pg_duckdb/deb/debian/control.libduckdb.in
  • packaging/pg_duckdb/deb/debian/pgedge-libduckdb.install
  • packaging/pg_duckdb/deb/debian/pgedge-postgresql-pg-duckdb.install
  • packaging/pg_duckdb/deb/debian/rules
  • packaging/pg_duckdb/rpm/pg_duckdb.spec

Included review availability: 1 review is currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


📝 Walkthrough

Walkthrough

The packaging changes create a shared libduckdb.so package owned by one PostgreSQL major. Debian and RPM builds now relocate or remove the library by ownership, add RPATH-based lookup, and constrain extension dependencies to the engine version range. Two changelog dates were corrected.

Changes

Shared DuckDB Engine Packaging

Layer / File(s) Summary
Shared engine ownership configuration
packaging/pg_duckdb/common.sh
The build configuration selects the highest configured PostgreSQL major as the shared engine owner, supports overrides and fallback, and defines shared library and engine version variables.
Build ownership wiring
packaging/pg_duckdb/build-deb.sh, packaging/pg_duckdb/build-rpm.sh
Debian and RPM build scripts pass ownership settings and shared library paths into package builds. Debian metadata receives engine version bounds, and both builds add runtime lookup configuration.
Debian shared-library packaging
packaging/pg_duckdb/deb/debian/*
Debian metadata defines pgedge-libduckdb and version-bounded extension dependencies. Installation moves libduckdb.so for the owner build, removes it from other builds, resolves dependencies from the DuckDB build tree, and validates missing files.
RPM shared-library packaging
packaging/pg_duckdb/rpm/pg_duckdb.spec, packaging/coldfront-duckdb-extensions/rpm/coldfront-duckdb-extensions.spec, packaging/coldfront/rpm/coldfront.spec
The RPM spec adds the conditional shared-library package, exact engine dependency, RPATH, owner relocation, non-owner removal, and conditional file lists. Two RPM changelog dates were corrected.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to 81768

The PR consolidates the shared DuckDB library into a version-pinned package while keeping per-major PostgreSQL packages focused on the extension; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the shared libduckdb.so package, RPATH changes, version ownership, dependency pinning, and validation results.
Title check ✅ Passed The title clearly and concisely identifies the primary change: shipping libduckdb.so once in a shared pgedge-libduckdb package.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch shared-libduckdb

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@maqeel75
maqeel75 requested review from vyruss and removed request for vyruss August 20, 2026 14:34
@maqeel75 maqeel75 closed this Aug 20, 2026
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.

1 participant