Re: pg_dump: remove restore.sql from tar format

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump: remove restore.sql from tar format
Date: 2026-11-20 07:39:56
Message-ID: av/5TNz5zI2GWq10@bdtpg
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Thu, Nov 19, 2026 at 03:58:54PM -0600, Nathan Bossart wrote:
> 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?

Thanks for the patch!

+1 for removing it. Keeping a second TOC pass and tar specific machinery for an
undocumented script does not seem worth it (especially since pg_restore -f provides
the supported way to generate a script).

Having said that, the patch LGTM.

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-11-20 07:40:53 Re: Checkpoints stuck after a failed bulk write inside a savepoint
Previous Message Chao Li 2026-11-20 07:38:19 Re: [PATCH v2] Reject duplicate SQL/JSON PASSING argument names