pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix pg_dump's handling of dependencies for custom opclasses.
Date: Wed, 31 Jul 2019 19:43:17 +0000
Message-ID: <E1hsuVJ-0007ay-OG@gemulon.postgresql.org> (raw)

Fix pg_dump's handling of dependencies for custom opclasses.

Since pg_dump doesn't treat the member operators and functions of operator
classes/families (that is, the pg_amop and pg_amproc entries, not the
underlying operators/functions) as separate dumpable objects, it missed
their dependency information.  I think this was safe when the code was
designed, because the default object sorting rule emits operators and
functions before opclasses, and there were no dependency types that could
mess that up.  However, the introduction of range types in 9.2 broke it:
now a type can have a dependency on an opclass, allowing dependency rules
to push the opclass before the type and hence before custom operators.
Lacking any information showing that it shouldn't do so, pg_dump emitted
the objects in the wrong order.

Fix by teaching getDependencies() to translate pg_depend entries for
pg_amop/amproc rows to look like dependencies for their parent opfamily.

I added a regression test for this in HEAD/v12, but not further back;
life is too short to fight with 002_pg_dump.pl.

Per bug #15934 from Tom Gottfried.  Back-patch to all supported branches.

Discussion: https://postgr.es/m/15934-58b8c8ab7a09ea15@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/07b39083c2aca003c4b1f289d7dc2368b5e2297a

Modified Files
--------------
src/bin/pg_dump/pg_dump.c        | 35 +++++++++++++++++++++++++++++++++--
src/bin/pg_dump/t/002_pg_dump.pl | 29 +++++++++++++++++++++++++++++
2 files changed, 62 insertions(+), 2 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1hsuVJ-0007ay-OG@gemulon.postgresql.org>
Permalink:  ../E1hsuVJ-0007ay-OG@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1hsuVJ-0007ay-OG@gemulon.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix pg_dump's handling of dependencies for custom opclasses.
  In-Reply-To: <E1hsuVJ-0007ay-OG@gemulon.postgresql.org>
  References: <E1hsuVJ-0007ay-OG@gemulon.postgresql.org>

* 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