Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gsVpa-0000S9-Ru for pgsql-hackers@arkaria.postgresql.org; Sat, 09 Feb 2019 16:50:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gsVpZ-0003yR-2x for pgsql-hackers@arkaria.postgresql.org; Sat, 09 Feb 2019 16:50:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gsVpY-0003yK-OL for pgsql-hackers@lists.postgresql.org; Sat, 09 Feb 2019 16:50:16 +0000 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gsVpV-0002Ap-Pz for pgsql-hackers@postgresql.org; Sat, 09 Feb 2019 16:50:15 +0000 Received: by mail-qk1-x742.google.com with SMTP id m9so4012235qkl.4 for ; Sat, 09 Feb 2019 08:50:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=MH0+X/8ru6yDc63AqkhEyP5SSeg1LqDV9mbK83rmMoM=; b=CsKlC7m53yk4fRFuzXD4ogN64mMot+NmNWTKCBizDLl743iovdog8Zmomsedaj2ffb n/Ql8XATzrR6s317+NrnvOGY0BOs9Lu7uGCVHCUSfH46jCFPeDO4wLbq2Bqcw7YM9REc xDYOqlcSkIQ4LKlJmWqDiARznI1V66rPm1k2HQfta+w3Xvoa42xcqxkYsmbiI+oxFn+q iHfdoqL7ck3pHFhrAubDbg7M6ouQ0eb0/ULEXE+eheydJ73jqVdY3539et6z1KHYE9pE 4cSih1Q/2cG0K/oap93j9BJfHay5TBF6IpS3U2AITsCwj+ysGPctqkYZXTnwCeTGJYaF FzSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=MH0+X/8ru6yDc63AqkhEyP5SSeg1LqDV9mbK83rmMoM=; b=V2Pvx355P4cNc0Ky4DfZ1KObwkypJeUMmsDnBtdcUgflEVkyqIWbReCzI1WA6ctGht X3rm43H9F31q8xZKJRPBqzgOgFSvy2HpEpKAcIAaYwWsYiLD+XYqP/VONQ929NRO+A++ pGqpKyRZrj3EM4yRR7sVrt54KxZ9FPkzP7Ts50ge06FzpvSGJgZPyLsMzMJQS+R4DpXT PbK3whsuieJdOH1OCQPy6maB1YAOfn7DR7VeKOSFhnQpUzcxjwoic96B592NO5qYg+MK 8NT7BhkEXRU0MZyMJgexSK9oUjwyHSLndGlOSHa1BBDY7HKxoqKpqhrStrt+UcolCYMN x/sA== X-Gm-Message-State: AHQUAuahObrhQVtlmhIo0OLTTiMZGq+oToks3MMpOeB15h3vrhboe7Nc fzSFYpzpO7T5026+CrpbvrxfVg== X-Google-Smtp-Source: AHgI3IYgyNe3SZhCUOGKlCX4LzVzCMfK/KBy/wPEVN5z0MbwKGcCP+QZHw1lYRTDGldaqu3ZNLot6Q== X-Received: by 2002:a37:4a87:: with SMTP id x129mr19921758qka.142.1549731012843; Sat, 09 Feb 2019 08:50:12 -0800 (PST) Received: from nimloth.alvh.no-ip.org ([201.186.80.67]) by smtp.gmail.com with ESMTPSA id c129sm6075803qka.30.2019.02.09.08.50.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Feb 2019 08:50:12 -0800 (PST) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 82AA612466A; Sat, 9 Feb 2019 13:50:10 -0300 (-03) Date: Sat, 9 Feb 2019 13:50:10 -0300 From: Alvaro Herrera To: Tom Lane Cc: Amit Langote , Peter Geoghegan , PostgreSQL Hackers Subject: Re: Fixing findDependentObjects()'s dependency on scan order (regressions in DROP diagnostic messages) Message-ID: <20190209165010.GA4298@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5943.1549728638@sss.pgh.pa.us> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-Feb-09, Tom Lane wrote: > Alvaro Herrera writes: > > On 2019-Feb-09, Tom Lane wrote: > >> No, that's still the back end of the deletion machinery, and in particular > >> it would fail to clean pg_depend entries for the trigger. Going in by the > >> front door would use performDeletion(). (See deleteOneObject() to get > >> an idea of what's being possibly missed out here.) > > > This patch I think does the right thing. > > (squint ...) Don't much like the undocumented deleteDependencyRecordsFor > call; that looks like it's redundant with what deleteOneObject will do. > I think you're doing it to get rid of the INTERNAL dependency so that > deletion won't recurse across that, but why is that a good idea? Needs > a comment at least. Yeah, it's deleting the INTERNAL dependency, because otherwise the trigger deletion is (correctly) forbidden, since the constraint depends on it. Perhaps it'd be good to have it be more targetted: make sure it only deletes that dependency row and not any others that the trigger might have (though I don't have it shouldn't have any. How could it?) I'd do that by adding a new function long deleteExactDependencyRecords(Oid classId, Oid objectId, Oid refclassId, Oid refobjectId) and calling that instead of deleteDependencyRecordsFor. > Also, I suspect you might need a second CCI after the performDeletion > call, in case the loop iterates? Can do. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services