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 1gsWdA-0002xS-Dq for pgsql-hackers@arkaria.postgresql.org; Sat, 09 Feb 2019 17:41:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gsWd8-0000wN-R0 for pgsql-hackers@arkaria.postgresql.org; Sat, 09 Feb 2019 17:41:30 +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 1gsWd8-0000sA-4x for pgsql-hackers@lists.postgresql.org; Sat, 09 Feb 2019 17:41:30 +0000 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gsWd4-0003Og-Kg for pgsql-hackers@postgresql.org; Sat, 09 Feb 2019 17:41:28 +0000 Received: by mail-qt1-x842.google.com with SMTP id r9so7641580qtt.3 for ; Sat, 09 Feb 2019 09:41:26 -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=4KHUfLvmk2E4EJBwVoKubBnr+TV59RJJqX9zlfjpwZA=; b=lcSvdkMFU8oXLwviHMqUXhsSAuiQfaQqvNFLYDVp/zSVq3cShFXEWq+Puo0x8kHIQg Awb6aIjzNGpUvxLajHSZ0cFDM7YDCMGRkYo8LsfWoBgzwUZDZHHE68QzDx5lyVm4qV1c QAS2IOvOLIALdo28TWXhkIvjs1Y1N5zRf61B4p6g6V+s9j0xu2uFZim+lQwOw+C79Jdz Rj3LTxNAlG51qC13qaN+94zwo+hEorlXLPOYDhLUsMCzAd9/F7tYjmCf5pnhPXyVzuer lBWju2SBX6kqKWXG+U6pFM3S6qYQ5y69JVue4GhSG3O0U6AozChnzcXU7U7KVv2lQwhd UOUg== 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=4KHUfLvmk2E4EJBwVoKubBnr+TV59RJJqX9zlfjpwZA=; b=X8IHC3l9ybVkn0yo6RXiQxhiKPbdngAey5G7IYw9OZUm/KBn2Ac5m3+2zptBmZetUr 1YfzcMCMq7XdrSwq8r+H29Z0rryXYQpHDjoFviFS9oxEGOqs8bJUkmfGVo3s5wrX9tgF AHmpenIzdpXRwFVL6IQaEBf6dVto3jqB/CaJt702LYIBR5tUDMu6V4ZURCB/hzGByf0x qCzSqLI6gjxwilfLPnSX8Uje6mpvnTMcAIJ7ehCKQApKoXTMj3Wrix2HgQyx7Yoh+ZsK GEd/0tKMisQed2UsrmuQcQFmggaiJekYwbsJL6+X1BYJnGgiNKbjfphc0rnrHIiaVXHo cEoA== X-Gm-Message-State: AHQUAubRFGwvE4XxiVea5T6OcF23p6LPhnSsfu5HzdEvKjtc8lSGJIQ9 anhMot/+VlBK4SVV9dnYvzsCzg== X-Google-Smtp-Source: AHgI3IZ1YzSoJZ7YCAHIJOFe44EyEYnqYiuN8Jf5TxD825K7iMmIyx24T1N4plptyAY80nUJbPEFXA== X-Received: by 2002:ac8:1245:: with SMTP id g5mr21319868qtj.139.1549734085645; Sat, 09 Feb 2019 09:41:25 -0800 (PST) Received: from nimloth.alvh.no-ip.org ([201.186.80.67]) by smtp.gmail.com with ESMTPSA id 10sm6961428qtx.60.2019.02.09.09.41.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Feb 2019 09:41:24 -0800 (PST) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 14B1F12466A; Sat, 9 Feb 2019 14:41:23 -0300 (-03) Date: Sat, 9 Feb 2019 14:41:23 -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: <20190209174123.GA6498@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <23859.1549732100@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: > >> 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. > > Well, the question that's begged here is exactly why it's okay to remove > the trigger and dependency link despite the fact that the constraint needs > it. I suppose the answer is that we'll subsequently insert a new trigger > implementing the same constraint (and internally-linked to it)? That > information is what I'd like to have in the comment. Well, the answer is that the trigger is no longer needed. This is an action trigger, i.e. it's attached to the referenced relation; and the action is making an independent table become a partition. Since the partition is reachable by the action trigger that goes through the parent table, we no longer need the action trigger that goes directly to the partition. Conversely, when we detach a partition, we create an action trigger that wasn't there before. I'll put this in the comment. > > 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 > > I'm not sure that'd be an improvement, especially in light of the > hazard that the trigger might somehow have acquired extension and/or > partition dependencies that'd also cause issues. Good point. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services