pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathandbossart@gmail.com>
To: andrewbille@gmail.com
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19086: pg_dump --data-only selects and do not uses index definitions for the dumped tables.
Date: Tue, 14 Oct 2025 14:36:50 -0500
Message-ID: <aO6mUj9H2WpEFylG@nathan> (raw)
In-Reply-To: <19086-871ff11017d03dc5@postgresql.org>
References: <19086-871ff11017d03dc5@postgresql.org>

On Tue, Oct 14, 2025 at 08:13:52AM +0000, PG Bug reporting form wrote:
> In case of system indexes corruption the collecting of index definitions can
> take a really long time.

I don't think this qualifies as a bug, but avoiding pg_dump queries when
possible seems like a good idea.  Is this a hypothetical problem or
something you've experienced?

> -       pg_log_info("reading indexes");
> -       getIndexes(fout, tblinfo, numTables);
> +       if (!dataOnly)
> +       {
> +               pg_log_info("reading indexes");
> +               getIndexes(fout, tblinfo, numTables);
> 
> -       pg_log_info("flagging indexes in partitioned tables");
> -       flagInhIndexes(fout, tblinfo, numTables);
> +               pg_log_info("flagging indexes in partitioned tables");
> +               flagInhIndexes(fout, tblinfo, numTables);
> +       }

I think we ordinarily leave it up to the get*() functions to return early.
For example, getPartitioningInfo() has this near the top:

	/* needn't bother if not dumping data */
	if (!fout->dopt->dumpData)
		return;

Also, we need to be certain that nothing getIndexes() gathers is ever used
for --data-only dumps.  That seems plausible, but I haven't looked closely.

-- 
nathan





view thread (20+ messages)  latest in thread

Message-ID: <aO6mUj9H2WpEFylG@nathan>
Permalink:  ../aO6mUj9H2WpEFylG@nathan/
Also on:    postgresql.org/message-id/aO6mUj9H2WpEFylG@nathan

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: nathandbossart@gmail.com, andrewbille@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #19086: pg_dump --data-only selects and do not uses index definitions for the dumped tables.
  In-Reply-To: <aO6mUj9H2WpEFylG@nathan>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox