Re: Why pg_dump overwrites dump file?

Bruce Momjian <bruce@momjian.us>

From: Bruce Momjian <bruce@momjian.us>
To: Daniel Gustafsson <daniel@yesql.se>
Cc: Chao Li <li.evan.chao@gmail.com>, Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-10-29T20:29:44Z
Lists: pgsql-hackers
On Wed, Oct 29, 2025 at 10:12:02PM +0200, Daniel Gustafsson wrote:
> > On 29 Oct 2025, at 20:47, Bruce Momjian <bruce@momjian.us> wrote:
> > 
> > On Tue, Oct 14, 2025 at 10:44:37AM +0200, Daniel Gustafsson wrote:
> >> Another inconsistency is that the documentation states this:
> >> 
> >>    "In this case the directory is created by pg_dump and must not exist
> >>    before."
> >> 
> >> ..which isn't true, since it will happily reuse an existing directory as long as
> >> it's empty, the comment in the code makes the intention clear:
> >> 
> >>  /*
> >>   * create_or_open_dir
> >>   *
> >>   * This will create a new directory with the given dirname. If there is
> >>   * already an empty directory with that name, then use it.
> >>   */
> >> 
> >> So regardless it seems we should something like the attached at least.
> 
> Yes, I had left it in my TODO for after my vacation (ie next week) to leave time for the OP (or someone else) to propose something different. 

Okay, just checking, thanks.  My GUC random_page_cost doc patch is
in similar status.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Do not let urgent matters crowd out time for investment in the future.



Commits

  1. doc: Fix incorrect wording for --file in pg_dump