Re: Fixing findDependentObjects()'s dependency on scan order (regressions in DROP diagnostic messages)

Peter Geoghegan <pg@bowt.ie>

From: Peter Geoghegan <pg@bowt.ie>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2019-02-10T18:22:37Z
Lists: pgsql-hackers
On Sun, Feb 10, 2019 at 8:50 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >>> [ invent separate primary and secondary partition dependencies? ]

> Here's a version of the patch that does it that way.

Now that I see separate DEPENDENCY_PARTITION_PRI and
DEPENDENCY_PARTITION_SEC dependency types, I agree that it's clearer
that way. It certainly clarifies what external dependency.c callers
are up to.

Minor issue here:

> !     <varlistentry>
> !      <term><symbol>DEPENDENCY_PARTITION_SEC</symbol> (<literal>S</literal>)</term>
> !      <listitem>
> !       <para>
> !        A <quote>secondary</quote> partition dependency acts identically to
> !        a primary one, except that the primary dependency is preferentially
> !        referenced in error messages.  An object should have at most one
> !        primary partition dependency, but there could perhaps be multiple
> !        secondary dependencies.
> !        Example: actually, we'll set up a child partitioned index with the
> !        parent partitioned index as primary partition dependency and the
> !        partition table as secondary partition dependency.  In this way,
> !        if the user tries to drop the child partitioned index, the error
> !        message will suggest dropping the parent partitioned index instead
> !        (not the table).
>         </para>

I think that the wording for this example needs to be tweaked.

Other than that, looks good to me.

-- 
Peter Geoghegan


Commits

  1. Redesign the partition dependency mechanism.

  2. Fix trigger drop procedure

  3. Sort the dependent objects before recursing in findDependentObjects().

  4. Avoid sometimes printing both tables and their columns in DROP CASCADE.