pg_dump: remove restore.sql from tar format

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: pg_dump: remove restore.sql from tar format
Date: 2026-11-19 21:58:54
Message-ID: av9xHiD2nv3s3RgZ@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tar-format dumps include an undocumented restore.sql script that can be run
with psql after extracting the archive and hand-editing its $$PATH$$
placeholders. pg_restore never reads it. This script has needed a number
of fixes over the years (e.g., commits bf0945e863, ff75219e9f, 3c5d9d914f,
and 146e03e79a), and it still fails to restore table data for dumps taken
with --inserts. Furthermore, it is generated by a second pass over the
TOC, which forced tar-only hacks into the statistics code added by commits
7d5c83b4e9 and 9c02e3a986. Those hacks run all the attribute statistics
queries a second time just for this file.

We could spend more time fixing restore.sql, but by all indications, it
sees minimal use, and "pg_restore -f" can generate a script from the same
archive. IIRC this file was originally added in case users did not have
access to pg_restore, but that seems like a relatively unlikely situation
these days. So, I think we should just remove it, as per the attached.

Thoughts? As I've mused elsewhere, IMHO we should seriously consider
putting tar format on a path to deprecation, but I'm saving that for
another thread.

--
nathan

Attachment Content-Type Size
v1-0001-pg_dump-Remove-restore.sql-from-tar-format.patch text/plain 17.6 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2026-11-19 22:04:13 Re: Block various aggregate component functions from being called directly
Previous Message Melanie Plageman 2026-11-19 21:42:43 Re: WAL_LOG CREATE DATABASE strategy broken for non-standard page layouts