Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jQFNv-0004Ux-Cr for pgsql-hackers@arkaria.postgresql.org; Sun, 19 Apr 2020 19:13:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jQFNu-0004tc-7j for pgsql-hackers@arkaria.postgresql.org; Sun, 19 Apr 2020 19:13:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jQFNt-0004oE-Kn for pgsql-hackers@lists.postgresql.org; Sun, 19 Apr 2020 19:13:41 +0000 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jQFNm-0000VC-18 for pgsql-hackers@lists.postgresql.org; Sun, 19 Apr 2020 19:13:39 +0000 Received: by mail-qk1-x743.google.com with SMTP id j4so8335057qkc.11 for ; Sun, 19 Apr 2020 12:13:33 -0700 (PDT) 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=DUfTDnglKvlrFaSVWcFKfANTyLKUkGM/DKcswEpuLeo=; b=saT76g+bn0QIA+VRJUEKE3R4V0AVb1uxhIWmKG7vJdq/tShYqIbfC83hfvli/QlEql pukk/qMB0faip9A4iNe0ZaBKetH7re/bYVwZ3FgoZ7bYNqa1+cv1YNcu+/Obs/wZ9rVh L3J86SHTXEVtwn5euIERFaMu+62NUGSHCeZ/yPOkqklLKVQjo6/1G0Q1ZksDUHtch12P wIzfb9BTUwutGoKiFiMae+vOAGxZA5mxrR0Sty113vvLn+9HyVNHrSi3fKPF1AG3i8IV hMJz6NLiZOaIieHvjAqR4WleaJbygk/XB5KnKWnFnHtQ1VXAMTNEvS8U3vUfl4rGoZzq mvaQ== 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=DUfTDnglKvlrFaSVWcFKfANTyLKUkGM/DKcswEpuLeo=; b=qkg/CaK6DFXMcgOvFTodG03GNZtA4MUvhYP8MnEqqebzvtInQflR1fXGTTqvMs6RdQ z0eHOlTN3MdQjODo1oZjJdOP9wAqnCV6zor1J+ha02Ns30VI1Vh5Dr5pTMmimK+7qNWz 7qzi12VANkEHjKuVHf7d/QxiBKqfmTobsGsWqz2igyxv45pDDr01GaqEF9VV1BZpjUgS FXprYRkMp0gKMzIEws2iLNZcqqScozhCuVaVGaVuOkbFyLtVj6QVfboeC8BR26g2ASfB ajVwWK0MNBGKKOAc+y8JqqkWZc2YrRMn4IqvH7ZuoKhkuDCry8lSP5FFOKvoiJVrkNaF kTag== X-Gm-Message-State: AGi0PuZ/EHSXN2q7OEWE8pllrYkJf511NXc4OJx3dSvi8A8O4qhfoPbt P2A8KKGAB3B6tuY9eX6YVpBnyg== X-Google-Smtp-Source: APiQypIvUwvtI4D6Ex1c9aHTNZog6AceudbLdqQL4Eo6STf7+b1SsuLH+8lJtEM41kmfBA/eRl40HA== X-Received: by 2002:a37:2714:: with SMTP id n20mr12361837qkn.291.1587323612511; Sun, 19 Apr 2020 12:13:32 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([190.95.18.252]) by smtp.gmail.com with ESMTPSA id h6sm8291319qtd.79.2020.04.19.12.13.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 12:13:31 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 0A9363014C9; Sun, 19 Apr 2020 15:13:29 -0400 (-04) Date: Sun, 19 Apr 2020 15:13:29 -0400 From: Alvaro Herrera To: Justin Pryzby Cc: Tom Lane , Amit Langote , pgsql-hackers@lists.postgresql.org Subject: Re: DETACH PARTITION and FOR EACH ROW triggers on partitioned tables Message-ID: <20200419191329.GA32288@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200419002206.GM26953@telsasoft.com> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Apr-18, Justin Pryzby wrote: > I haven't heard a compelling argument for or against either way. > > Maybe the worst behavior might be if, during ATTACH, we searched for a matching > trigger, and "merged" it (marked it inherited) if it matched. That could be > bad if someone *wanted* two triggers, which seems unlikely, but to each their > own. I think the simplicity argument trumps the other ones, so I agree to go with your v3 patch proposed downthread. What happens if you detach the parent? I mean, should the trigger removal recurse to children? > It occured to me that we don't currently distinguish between a trigger on a > child table, and a trigger on a parent table which was recursively created on a > child. That makes sense for indexes and constraints, since the objects persist > if the table is detached, so it doesn't matter how it was defined. > > But if we remove trigger during DETACH, then it's *not* the same as a trigger > that was defined on the child, and I suggest that in v13 we should make that > visible. Hmm, interesting point -- whether the trigger is partition or not is important because it affects what happens on detach. I agree that we should make it visible. Is the proposed single bit "PARTITION" good enough, or should we indicate what's the ancestor table that defines the partition? -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services