Skip to content

pg_mooncake 0.3.4: pg_duckdb 1.2.1+ Support & Direct Upgrades

pg_mooncake 0.3.4 accepts pg_duckdb 1.2.1 and later (reference build 1.2.2 on DuckDB v2.0.1), pins PGXS module versions in source archives, provides direct SQL upgrades from 0.3.0–0.3.3, and documents durable 0.3.0 WAL retirement.

pg_mooncake 0.3.4 removes the rigid exact-version lock on pg_duckdb, accepting pg_duckdb 1.2.1 and later on installation and upgrade while advancing the reference build to pg_duckdb 1.2.2 (embedding DuckDB v2.0.1). It continues to bundle Moonlink v0.3.0-pgsty.2 and duckdb_mooncake v0.0.5, provides direct SQL upgrades from all prior PGSTY 0.3.x releases (0.3.0 through 0.3.3), and has been validated end-to-end across PostgreSQL 15 through 19.

Component Matrix

Component Version / Tag Revision Notes
pg_mooncake v0.3.4 479f8ec8c2 PostgreSQL 15–19 (pgrx 0.20.0, Rust 1.99.1)
pg_duckdb >= 1.2.1 (ref 1.2.2) 4e921ffbe4 Lower-bound SemVer check; reference 1.2.2 and 1.2.1 both embed DuckDB v2.0.1
moonlink v0.3.0-pgsty.2 bae6634bf6 Durable Iceberg snapshot acknowledgements; Iceberg 0.11.0, Arrow/Parquet 58.4.2, SQLx 0.9.1
duckdb_mooncake v0.0.5 89413ba02d DuckDB v2.0.1 (8d78114e90); per-scan connections & pinned durability RPC

Summary of Changes

Area Change
pg_duckdb >= 1.2.1 lower bound Replaces the exact pg_duckdb = 1.2.1 guard with semantic-version lower-bound enforcement (handling numeric major.minor.patch and prerelease precedence) across installation and upgrade SQL scripts. Both tested pg_duckdb 1.2.1 and 1.2.2 embed DuckDB v2.0.1 and share bundled scanner v0.0.5. Operators choosing a newer pg_duckdb with a different DuckDB engine must verify its PostgreSQL interfaces and supply scanner v0.0.5 built for that engine and platform.
Pinned PGXS module version Adds scripts/pg_duckdb.mk and overrides CPPFLAGS with -DPG_DUCKDB_VERSION from versions.json, rebuilding src/pgduckdb.o whenever pins change so source builds emit the pinned pg_duckdb module version consistently in both Git checkouts and unpacked source archives.
Direct SQL upgrades (0.3.0–0.3.3) Ships direct SQL upgrade scripts 0.3.0--0.3.4, 0.3.1--0.3.4, 0.3.2--0.3.4, and 0.3.3--0.3.4. Existing 0.3.2 and 0.3.3 mirror registrations and generations are preserved while enforcing pg_duckdb >= 1.2.1 and loaded scanner v0.0.5.
Durable 0.3.0 WAL retirement guide Documents how to emit a transactional logical WAL marker and take a verified Iceberg snapshot (flush_lsn) before retiring the legacy 0.3.0 worker’s private _wal directory offline.

Upgrading to 0.3.4

From 0.3.1, 0.3.2, or 0.3.3

  1. Install the pg_mooncake 0.3.4 libraries, compatible pg_duckdb (>= 1.2.1, reference 1.2.2), and scanner v0.0.5 into your local mooncake.extension_repository, then restart PostgreSQL.
  2. If upgrading from 0.3.1 or 0.3.2, refresh the cached DuckDB scanner before updating the extension, then open a fresh session so the backend loads v0.0.5:
    SELECT duckdb.raw_query(
        format('FORCE INSTALL mooncake FROM %L', current_setting('mooncake.extension_repository'))
    );
  3. In each database with pg_mooncake installed, update pg_duckdb (if its installed library changed) and update pg_mooncake:
    ALTER EXTENSION pg_duckdb UPDATE TO '1.2.2';
    ALTER EXTENSION pg_mooncake UPDATE TO '0.3.4';
  4. If upgrading from 0.3.1 or 0.3.2, run a fresh CALL mooncake.create_snapshot(...) on every mirror before using it as a backup or migration boundary.

From WAL-Based PGSTY 0.3.0

PGSTY 0.3.0 used Moonlink v0.0.1 (b298ef74), which could acknowledge source changes into its private _wal before Iceberg persistence. Perform these steps on every database with mirrors before switching binaries:

  1. Stop writers to every source table (including remote sources) and take a recoverable backup of both PostgreSQL and the complete Moonlink directory.
  2. On the old 0.3.0 binaries, wait until each mirror matches its quiescent source (comparing all columns in both directions with EXCEPT ALL) and record each mirror’s commit_lsn from mooncake.list_tables(). For a source on the same PostgreSQL cluster, run both statements in the same autocommit session so create_snapshot receives a commit LSN after the last source write:
    SELECT pg_catalog.pg_logical_emit_message(true, 'pg_mooncake_upgrade', 'snapshot');
    CALL mooncake.create_snapshot('schema.mirror');
    Recheck mooncake.list_tables() and proceed only once flush_lsn covers the recorded source change (including a delete that emptied a mirror).
  3. Stop PostgreSQL cleanly, move the old _wal directory outside the active Moonlink data directory and keep it with your backup (the new worker refuses to start if a nonempty _wal remains).
  4. Install the matched pg_mooncake 0.3.4, pg_duckdb, and scanner v0.0.5, start PostgreSQL, and run ALTER EXTENSION pg_duckdb UPDATE TO '1.2.2'; (if upgraded) followed by ALTER EXTENSION pg_mooncake UPDATE TO '0.3.4'; in a fresh session.
  5. Re-verify source/mirror parity, commit one identifiable test change, verify it in the mirror, and take a fresh snapshot before resuming writers. See the full upgrade guide for remote-source details.

Source Release Assets & Checksums

The attached pg_mooncake-0.3.4-source.tar.gz bundles all pinned Git submodules. Verify with sha256sum -c SHA256SUMS (shasum -a 256 -c SHA256SUMS on macOS). See changes since v0.3.3 for the exact commit diff.

Download asset
FileChecksum
pg_mooncake-0.3.4-source.tar.gz SHA-256 0b92e9d2…e7bb
SHA256SUMS SHA-256 470812b9…a036

Validation

Platform & Engine Coverage
Linux ARM64 · PostgreSQL 15, 16, 17, 18, 19 Tested with both pg_duckdb 1.2.1 and pg_duckdb 1.2.2. With 1.2.2, every PostgreSQL major (15–19) passed all 10 pg_regress SQL suites and full integration checks across real server restarts.
macOS ARM64 · PostgreSQL 19 Passed full SQL regression suites and post-restart integration checks.
Upgrade matrix Direct SQL upgrades from all four previous PGSTY versions (0.3.0, 0.3.1, 0.3.2, 0.3.3) exercised end-to-end with existing mirror data.

Table reader