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-10T19:53:58Z
Lists: pgsql-hackers
On Sun, Feb 10, 2019 at 11:34 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> After looking closer, I find that it's valid SGML to collapse the two
> items into one entry

I'll have to remember that detail -- seems like it'll come in handy again.

>     <varlistentry>
>      <term><symbol>DEPENDENCY_PARTITION_PRI</symbol> (<literal>P</literal>)</term>
>      <term><symbol>DEPENDENCY_PARTITION_SEC</symbol> (<literal>S</literal>)</term>
>      <listitem>
>       <para>

>        Primary and secondary partition dependencies behave identically
>        except that the primary dependency is preferred for use in error
>        messages; hence, a partition-dependent object should have one
>        primary partition dependency and one or more secondary partition
>        dependencies.
>        Note that partition dependencies are made in addition to, not
>        instead of, any dependencies the object would normally have.  This
>        simplifies <command>ATTACH/DETACH PARTITION</command> operations:
>        the partition dependencies need only be added or removed.
>        Example: a child partitioned index is made partition-dependent
>        on both the partition table it is on and the parent partitioned
>        index, so that it goes away if either of those is dropped, but
>        not otherwise.  The dependency on the parent index is primary,
>        so that if the user tries to drop the child partitioned index,
>        the error message will suggest dropping the parent index instead
>        (not the table).

That seems perfect. It gets to the root of the matter.

-- 
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.