pgsql: Move tar detection and compression logic to common.
Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.
This thread has been committed, so CI has stopped here. Anything below is the last result it produced.
You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:
docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t247062psql -h localhost -U postgresBuilt from patchset v2 (message #2), August 02, 2026 at 10:21 PM.
Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:
git clone --branch t247062_2 https://github.com/hackorum-dev/postgres.gitIn a checkout you already have, add the fork once:
git remote add hackorum https://github.com/hackorum-dev/postgres.gitthen, for this patchset and every later one:
git fetch hackorum t247062_2 && git checkout t247062_2Patchset v2 (message #2) is on t247062_2
Move tar detection and compression logic to common.
Consolidate tar archive identification and compression-type detection
logic into a shared location. Currently used by pg_basebackup and
pg_verifybackup, this functionality is also required for upcoming
pg_waldump enhancements.
This change promotes code reuse and simplifies maintenance across
frontend tools.
Author: Amul Sul <sulamul@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Euler Taveira <euler@eulerto.com>
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>
discussion: /messages/by-id/CAAJ_b94bqdWN3h2J-PzzzQ2Npbwct5ZQHggn_QoYGhC2rn-=WQ@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/c8a350a439826267186c187dbfbf1f839f7521aa
Modified Files
--------------
src/bin/pg_basebackup/pg_basebackup.c | 36 ++++++++++---------------------
src/bin/pg_verifybackup/pg_verifybackup.c | 12 +----------
src/common/compression.c | 30 ++++++++++++++++++++++++++
src/include/common/compression.h | 2 ++
4 files changed, 44 insertions(+), 36 deletions(-)
On Fri, Mar 20, 2026 at 3:32 PM Andrew Dunstan <andrew@dunslane.net> wrote:
Move tar detection and compression logic to common.
Consolidate tar archive identification and compression-type detection
logic into a shared location. Currently used by pg_basebackup and
pg_verifybackup, this functionality is also required for upcoming
pg_waldump enhancements.https://git.postgresql.org/pg/commitdiff/c8a350a439826267186c187dbfbf1f839f7521aa
Unfortunately, this commit not only consolidated the logic but also
changed the behavior at both of the then-existing call sites for the
worse.
I attach a patch to undo those behavior changes, which I intend to
commit and back-patch to v19.
--
Robert Haas
EDB: http://www.enterprisedb.com
On Wed, Jul 22, 2026 at 12:23 PM Robert Haas <robertmhaas@gmail.com> wrote:
On Fri, Mar 20, 2026 at 3:32 PM Andrew Dunstan <andrew@dunslane.net>
wrote:Move tar detection and compression logic to common.
Consolidate tar archive identification and compression-type detection
logic into a shared location. Currently used by pg_basebackup and
pg_verifybackup, this functionality is also required for upcoming
pg_waldump enhancements.https://git.postgresql.org/pg/commitdiff/c8a350a439826267186c187dbfbf1f839f7521aa
Unfortunately, this commit not only consolidated the logic but also
changed the behavior at both of the then-existing call sites for the
worse.I attach a patch to undo those behavior changes, which I intend to
commit and back-patch to v19.
Thanks, Robert. The change in precheck_tar_backup could possibly do with a
comment like "Make sure there's nothing between the expected prefix and
suffix". I had to look hard to see what it was doing.
cheers
andrew
On Wed, Jul 22, 2026 at 3:28 PM Andrew Dunstan <andrew@dunslane.net> wrote:
Thanks, Robert. The change in precheck_tar_backup could possibly do with a comment like "Make sure there's nothing between the expected prefix and suffix". I had to look hard to see what it was doing.
Cool. I'll add some kind of a comment there before committing. Thanks
for the quick response.
--
Robert Haas
EDB: http://www.enterprisedb.com