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:01:19Z
Lists: pgsql-hackers
On Sun, Feb 10, 2019 at 8:13 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> How about this comment text?
>
>                 /*
>                  * The current target object should have been added to
>                  * targetObjects while processing the owning object; but it
>                  * probably got only the flag bits associated with the
>                  * dependency we're looking at.  We need to add the objflags
>                  * that were passed to this recursion level, too, else we may
>                  * get a bogus failure in reportDependentObjects (if, for
>                  * example, we were called due to a partition dependency).
>                  *
>                  * If somehow the current object didn't get scheduled for
>                  * deletion, bleat.  (That would imply that somebody deleted
>                  * this dependency record before the recursion got to it.)
>                  * Another idea would be to reacquire lock on the current
>                  * object and resume trying to delete it, but it seems not
>                  * worth dealing with the race conditions inherent in that.
>                  */

LGTM. I agree that referencing a counterfactual design that reacquires
the lock instead adds something.

> Just to be be clear, my inclination is to do nothing about this in v11.
> It's not apparent to me that any fix is possible given the v11 dependency
> data, at least not without downsides that'd likely outweigh the upsides.
> We've not seen field complaints about these problems.

I thought that you might have had a trick up your sleeve for v11,
although I had no idea how that would be possible without making sure
that partition dependencies came in pairs to begin with.  :-)

I'll reply to your new revision of the patch separately.

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