Skip to content

Releases

v2.3.1

Choose a tag to compare

@gmr gmr released this 02 Oct 18:09
v2.3.1
4b92313

Fixed

  • Dump::save() now sorts ROLE, USER and GROUP entries before all other TOC entries, with TABLESPACE entries directly after them, matching pg_dumpall's order. Previously these sorted last, so pg_restore of a sorted archive failed when an ALTER ... OWNER TO or CREATE TABLESPACE named a role that did not exist yet. USER MAPPING placement is unchanged. (#21)

v2.3.0

Choose a tag to compare

@gmr gmr released this 21 Sep 23:12
695f6c6

Added

  • Dump::sorts_on_save() and Dump::set_sort_on_save() to control whether saving reorders the TOC (#16)

Changed

  • Saving an archive that was loaded and not modified now preserves its TOC order instead of re-sorting it. pg_dump's ordering is authoritative, so rewriting it could only lose fidelity. Dumps built with new(), and loaded dumps whose entries are added to or modified, still sort on save as before (#16)
  • TOC sorting now reproduces pg_dump's placement rules: the ENCODING/STDSTRINGS/SEARCHPATH prelude keeps pg_dump's order, comments, security labels and ACLs follow the object they describe, constraint-like entries sort on the object name rather than the "<table> <name>" tag, and statistics sort by the kind of object they describe. Every test fixture except data-only archives now sorts into exactly the order pg_dump wrote (#16, #18)
  • Updated dependencies: lz4_flex from 0.11 to 0.14, zstd from 0.13 to 0.14, flate2 to 1.1.10, thiserror to 2.0.20 (#19)

Fixed

  • A dependency cycle no longer puts its members at the front of the archive, ahead of their schema and the prelude, which produced archives pg_restore could not read. One edge of the cycle is now dropped and the sort re-run, as pg_dump does (#15)
  • Column ACLs no longer sort to the end of the archive (#16)
  • get_entry_mut() no longer marks the TOC order stale when the lookup finds nothing (#16)

Known limitation

Data-only archives still sort differently from pg_dump. pg_dump orders TABLE DATA by foreign-key dependencies recorded against table entries that a data-only archive does not contain, so the order cannot be reconstructed from the archive. Loaded archives are no longer re-sorted on save, so this does not affect round-tripping.

v2.2.0

Choose a tag to compare

@gmr gmr released this 01 Sep 00:55
6dde1b4

What's Changed

Archives written by libpgdump could not be read by pg_restore in directory or tar format, and archives rewritten in any format were rejected by pg_restore before PostgreSQL 12. Anyone writing archives should upgrade.

Fixed

  • Directory and tar writers stored a NULL extra-TOC filename for entries with no data file. pg_dump writes an empty string, and pg_restore's _ReadExtraToc calls strlen() on it, so every directory or tar archive we wrote crashed pg_restore — including pg_restore -l (#12)
  • Tar members were written in filename order. pg_restore reads tar archives sequentially and rejected data members that came before the member of an earlier TOC entry, failing restores partway with "restoring data out of order is not supported in this archive format" (#12)
  • The directory writer renamed blob TOC files, which pg_restore 16 and earlier reject, and blob TOC filenames read from an archive are now rejected if they escape the output directory (#12)
  • read_string() collapsed empty strings to NULL. pg_dump writes "" for fields such as an entry's owner and drop statement, and pg_restore before PostgreSQL 12 calls strlen() on them with no NULL check, so rewritten archives segfaulted those versions in all three formats (#13)
  • set_compression() left the archive version alone, so selecting lz4 or zstd on an archive older than 1.15 — the version pg_dump 15 and earlier writes — failed with UnsupportedCompression. It now raises the version to 1.15, which added nothing but the compression-algorithm byte (#13)

Added

  • tar::read_metadata() reads a tar archive's header and TOC while seeking past the data members. pgdump-toc uses it, and no longer refuses tar archives with "unsupported format: 3" (#13)
  • Compressed data support in CustomReader::read_entry_reader() (#7), and a pgdump-toc CLI for inspecting an archive's header and TOC (#8), both by @NickCrews

Changed

  • Empty strings now read as Some("") rather than None. Entry fields such as owner, drop_stmt, and tablespace carry the distinction pg_dump makes between an empty string and NULL, so code matching on None for those fields may need updating
  • CI now tests against PostgreSQL 13 through 18, up from 16 through 18, and archives written by libpgdump are checked with a real pg_restore across every format and compression algorithm

Internal

  • Timestamp, Blob, and ArchiveData moved to types.rs, with read_timestamp()/write_timestamp() deduplicated (#9), and per-chunk allocation removed from the data reader (#7), both by @NickCrews

Full Changelog: v2.1.0...v2.2.0

v2.1.0

Choose a tag to compare

@gmr gmr released this 08 Apr 22:35
b376d5f

What's Changed

Added

  • Lazy CustomReader for custom format archives that reads only the header and TOC on construction, deferring data block reads until explicitly requested — enables working with archives too large to fit in memory (#5) (#6)
  • Buffered on-demand data reading via CustomReader::read_entry_data() returning EntryData enum
  • Streaming on-demand data reading via CustomReader::read_entry_reader() returning an EntryReader that implements Read
  • CustomReader::into_dump() for eager conversion to a full Dump after TOC inspection

Improved

  • CI release workflow now uses --locked to prevent Cargo.lock drift

v2.0.0

Choose a tag to compare

@gmr gmr released this 31 Mar 01:17
db0bf9a

Breaking Changes

  • Entry.desc is now ObjectType instead of String — The desc field on Entry is now a strongly-typed ObjectType enum with 50+ variants covering all known pg_dump object types, plus Other(String) for forward compatibility.
  • Dump::add_entry() takes ObjectType instead of &str — Pass ObjectType::Table, ObjectType::TableData, etc. instead of string literals.
  • Dump::lookup_entry() takes &ObjectType instead of &str for the desc parameter.
  • Error::EntityNotFound.desc is now ObjectType instead of String.

New Features

  • Weighted topological sort — TOC entries are automatically sorted on Dump::save() using the same two-phase algorithm as pg_dump (pg_dump_sort.c): cosmetic sort by type priority, namespace, and name, followed by Kahn's algorithm with a max-heap to satisfy dependencies while preserving order. Also available via Dump::sort_entries().
  • ObjectType enum — Type-safe representation of all pg_dump object types with section(), priority(), as_str(), Display, Ord, and From<&str>/From<String> conversions. Unknown types preserved via Other(String) for round-trip fidelity.
  • Dump::get_entry_mut() — Mutable access to entries by dump_id.

Improvements

  • Format readers now return an error on missing/NULL descriptors instead of silently defaulting to Other("").
  • ObjectType::as_str() returns &'static str for known variants, eliminating heap allocations in sort comparisons and format writers.
  • constants.rs reduced to just the MAGIC constant — all object type strings and section mapping are now methods on ObjectType.