pgsql: Fix pg_dump's handling of dependencies for custom opclasses. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Fix pg_dump's handling of dependencies for custom opclasses.
Date
Msg-id E1hsuVJ-0007b9-PJ@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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
------
REL9_4_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4e10b6f8235500b99ecd0a3ca7602acdf0034c8a

Modified Files
--------------
src/bin/pg_dump/pg_dump.c | 35 +++++++++++++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)


pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: pgsql: Run UTF8-requiring collation tests by default
Next
From: Michael Paquier
Date:
Subject: pgsql: Fix handling of previous password hooks in passwordcheck