# pg_mooncake 0.3.2: PostgreSQL 15–19, Mirror Generations & Iceberg 0.11

> pg_mooncake 0.3.2 brings PostgreSQL 15–19 (pgrx 0.20.0), DuckDB v2.0.1 / pg_duckdb 1.2.1, Moonlink v0.3.0-pgsty.1, duckdb_mooncake v0.0.4, generation-checked mirror lifecycle, smart shutdown, reproducible source archives, and zero RustSec vulnerabilities.

---

LLMS index: [llms.txt](/llms.txt)

---

**v0\.3\.2 · 2026-11-23**
- [View release](https://github.com/pgsty/pg_mooncake/releases/tag/v0.3.2)
- [Source · tar\.gz](https://github.com/pgsty/pg_mooncake/archive/refs/tags/v0.3.2.tar.gz)
- [Source · zip](https://github.com/pgsty/pg_mooncake/archive/refs/tags/v0.3.2.zip)
- [pgsty\/pg\_mooncake](https://github.com/pgsty/pg_mooncake)

> [!WARNING] Snapshot Durability Advisory
> On `pg_mooncake 0.3.2`, `CALL mooncake.create_snapshot(...)` can return before Apache Iceberg durably records the last source commit. **Upgrade to [`pg_mooncake 0.3.3`](/release/pg-mooncake-0.3.3/) or [`pg_mooncake 0.3.4`](/release/pg-mooncake-0.3.4/)** and take a fresh snapshot of each mirror before relying on it for backups or migrations. Compare an already restored mirror with its authoritative PostgreSQL source if its snapshot may have been affected.

**`pg_mooncake 0.3.2`** is the first published GitHub source release after [`pg_mooncake 0.3.0`](/release/pg-mooncake-0.3.0/), consolidating the `0.3.1` platform upgrade milestone (commit [`7fa3202a`](https://github.com/pgsty/pg_mooncake/commit/7fa3202aaaefc4105705fe4025a9850bb7bcb10f), superseded prior to GitHub Release publication) with mirror lifecycle reconciliation, smart shutdown, reproducible recursive source packaging, and a zero-vulnerability storage stack upgrade.

## Component Matrix {#components}

| Component | Version / Tag | Revision | Notes |
| :--- | :--- | :--- | :--- |
| **`pg_mooncake`** | `v0.3.2` | `4084aaf85c` | PostgreSQL 15–19 (`pgrx 0.20.0`, Rust `1.99.1`) |
| **`moonlink`** | [`v0.3.0-pgsty.1`](/release/moonlink-0.3.0-pgsty.1/) | `71c9dfcfa8` | Based on [`v0.3.0`](/release/moonlink-0.3.0/) (`dcf999a9f3`); Iceberg `0.11.0`, Arrow/Parquet `58.4.2`, SQLx `0.9.1` |
| **`duckdb_mooncake`** | [`v0.0.4`](/release/duckdb-mooncake-0.0.4/) | `da60e59d96` | Per-scan isolated Moonlink connections; DuckDB `v2.0.1` |
| **`pg_duckdb`** | `1.2.1` | `451d389a3f` | Embeds DuckDB `v2.0.1` (`8d78114e90`) |
{.wide .expand}

## Summary of Changes (Since `0.3.0`) {#changes}

| Area | Change |
| :--- | :--- |
| PostgreSQL 15–19 & `pgrx 0.20.0` | Upgrades `pgrx`/`cargo-pgrx` to `0.20.0` (requiring Rust `1.99.1+`), adds PostgreSQL 19 (`pg19` feature, `TableAmRoutine` and `planner_hook` adaptations), drops PostgreSQL 14 following pgrx policy (PG14 users remain on `0.3.0`), and matches PG18 runtime packages to build headers (`heap_datum_check`). |
| Upstream 0.3 hardening | Absorbs `mooncake.data_directory` postmaster GUC with `moonlink.lock` exclusive locking (for `pg_basebackup` and standbys), `planner_hook` and `ProcessUtility_hook` guards rejecting direct DML (`INSERT`, `UPDATE`, `DELETE`, `MERGE`, `TRUNCATE`, `COPY FROM`) and unsupported mirror DDL (`RENAME`, `SET SCHEMA`, `SET ACCESS METHOD`, `ATTACH PARTITION`, `INHERIT`), removes `mooncake.load_files`, adopts native `parse_ident` keys, and runs the `moonlink` worker at `RecoveryFinished` in a signal-isolated thread. |
| Generation-bound mirror lifecycle | Adds `mooncake.mirror_registrations`, `_bind_mirror`, `_reconcile_drops`, pre-commit callbacks, and an `sql_drop` event trigger. Each mirror binds to the exact Moonlink generation returned by `create_table`; committed drops and interrupted creations reconcile across restarts without risking a replacement generation. |
| Source-side freshness & smart shutdown | Pairs with [`duckdb_mooncake v0.0.4`](/release/duckdb-mooncake-0.0.4/) (independent per-scan connections) and source-server WAL watermarks (`SOURCE_WATERMARK`). Closes Moonlink's source connections when PostgreSQL enters smart shutdown so local mirrors do not block postmaster drain. |
| Direct upgrades & local scanner | Adds direct SQL upgrade scripts from `0.3.0` and `0.3.1` that check the loaded scanner, bind existing mirrors, and remove `mooncake.load_files`. Documents local scanner configuration (`mooncake.extension_repository` + `duckdb.allow_unsigned_extensions = on`) with `duckdb.allow_community_extensions` kept `off`. |
| Zero-vulnerability storage stack | Upgrades to **Iceberg `0.11.0`**, **OpenDAL `0.58.2`**, **Arrow/Parquet `58.4.2`**, and **SQLx `0.9.1`**. The November 23, 2026 RustSec audit found **0 vulnerability and 0 unsoundness matches** across all three lockfiles and default graphs (reporting 5, 3, and 2 unmaintained-crate notices for `pg_mooncake`, `moonlink`, and scanner FFI respectively). |
| Reproducible source distribution | Ships `scripts/source_archive.py` and a byte-for-byte reproducible `pg_mooncake-0.3.2-source.tar.gz` archive containing all pinned submodules (`36,086` tracked files) and supporting `make pg_duckdb` builds without `.git` metadata. |
{.wide .expand}

## Fresh Installation & Configuration {#install}

Use `pg_config --sharedir` for the target PostgreSQL major version and point `mooncake.extension_repository` to its absolute `extension/pg_mooncake` subdirectory in `postgresql.conf`:

```ini
duckdb.allow_unsigned_extensions = on
mooncake.extension_repository = '/usr/pgsql-18/share/extension/pg_mooncake'
# Set outside $PGDATA before creating mirrors when using pg_basebackup or streaming standbys:
# mooncake.data_directory = '/var/lib/pgsql/18/mooncake'
shared_preload_libraries = 'pg_duckdb,pg_mooncake'
wal_level = logical
```

`duckdb.allow_community_extensions` may stay `off`. Restart PostgreSQL and run `CREATE EXTENSION pg_mooncake CASCADE;` in a fresh session. If your PostgreSQL data path is non-UTF-8, set `duckdb.temporary_directory` and `duckdb.extension_directory` to writable UTF-8 paths.

## Upgrading Existing Installations {#upgrade}

- **From PGSTY `0.3.0` (WAL-based worker)**: Stop source writers, take and verify a snapshot of each mirror on the old binaries, compare source and mirror rows in both directions (`EXCEPT ALL`), stop PostgreSQL cleanly, and archive the complete storage backup plus the old `_wal` directory offline before starting the new worker.
- **From `0.3.1`**: Install the matching `v0.0.4` scanner into the local repository, refresh the cached scanner via `FORCE INSTALL mooncake FROM ...`, reconnect in a fresh session, and run `ALTER EXTENSION pg_mooncake UPDATE TO '0.3.2';`.
- **Recommended target**: Proceed directly to [`pg_mooncake 0.3.4`](/release/pg-mooncake-0.3.4/) (which supersedes `0.3.2` with the `create_snapshot` durability fix and `pg_duckdb >= 1.2.1` support).

## Source Release Assets & Checksums {#assets}

Verify downloads with `sha256sum -c SHA256SUMS` (or `shasum -a 256 -c SHA256SUMS` on macOS). The assets below are source distributions; native Linux packages are tracked separately in the [PGEXT package matrix](https://pgext.cloud/ext/pg_mooncake).

```checksums
ef5b2b8006ddfdad5b9fd4ad48e485052cf4fb2fcb49cec374c23818aad12d4e  pg_mooncake-0.3.2-source.tar.gz
f0762e3661ef3c5e7c785acd123a33a637a8ff1f1b2ab2e482a2ab5c7dd1aa24  SHA256SUMS
```

## Validation {#validation}

- **Reproducible source archive**: Two independent checkouts produced byte-for-byte identical tarballs (`36,086` tracked files). Unpacked sources built both `pg_duckdb` and `pg_mooncake` without Git metadata and passed full PG19 testing on a fresh cluster.
- **Runtime matrix**: Covered PostgreSQL `15.20`, `16.16`, `17.12` (Linux ARM64 dev builds), PostgreSQL `18.7` (Linux ARM64 release), and PostgreSQL `19.0` (macOS ARM64 release) — passing all **10** `pg_regress` suites, **3** version guards, **15** integration checks, a negative non-restart check, and **2** checks after a real server restart, plus direct upgrades from `0.3.0` and `0.3.1` and MinIO object-storage tests.

---

Backlinks:

- [duckdb_mooncake 0.0.4: Isolated Scan Connections & DuckDB 2.0.1](/release/duckdb-mooncake-0.0.4/)
- [moonlink 0.3.0-pgsty.1: Mirror Generations, Iceberg 0.11 & Security Audit](/release/moonlink-0.3.0-pgsty.1/)
