Re: BUG #19086: pg_dump --data-only selects and do not uses index definitions for the dumped tables.

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, andrewbille(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19086: pg_dump --data-only selects and do not uses index definitions for the dumped tables.
Date: 2025-10-16 00:35:24
Message-ID: CAApHDvp-BsfUne0TckE5f8-E9Ou3+2+fT0aN2OB+ccC88zy-yQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, 16 Oct 2025 at 12:36, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> (Hmm ... but on the third hand, if we only need one of the
> two strings, couldn't we mechanize that by wrapping the
> pg_get_indexdef call in CASE WHEN c.contype IS DISTINCT FROM 'x'
> ?)

Unless I'm mistaken, it looks like the "indexdef" field is used only
when there's no corresponding constraint with contype 'p,', 'u' or
'x'. Wouldn't it be more like:

CASE WHEN c.conrelid IS NULL THEN
pg_catalog.pg_get_indexdef(i.indexrelid) ELSE '' END AS indexdef

which saves calling the function a bit more often than what you said... ?

The code I'm looking at is:

/* Plain secondary index */
indxinfo[j].indexconstraint = 0;

and "if (!is_constraint)" in dumpIndex().

David

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2025-10-16 00:45:47 Re: BUG #19086: pg_dump --data-only selects and do not uses index definitions for the dumped tables.
Previous Message Tom Lane 2025-10-15 23:36:20 Re: BUG #19086: pg_dump --data-only selects and do not uses index definitions for the dumped tables.