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 1kUzhB-0002Sk-Jt for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Oct 2020 22:01:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kUzhA-0004Er-Fn for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Oct 2020 22:01:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kUzhA-0004Ds-33 for pgsql-hackers@lists.postgresql.org; Tue, 20 Oct 2020 22:01:28 +0000 Received: from mail-io1-xd36.google.com ([2607:f8b0:4864:20::d36]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kUzh4-000625-2x for pgsql-hackers@postgresql.org; Tue, 20 Oct 2020 22:01:24 +0000 Received: by mail-io1-xd36.google.com with SMTP id y20so457647iod.5 for ; Tue, 20 Oct 2020 15:01:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=5Rb3pA0PCvsc305Pcy64NG5Gmgb+aZXeKH7pH4/XWy8=; b=RkXWq93GsLiqoDQKrv1HAQmZGsntUTnqYocjVOhnlVkOMV3Qar+csy2ROBWLX3ghW+ 6KTaZdrkP6zub65Xb0kPai4yEkno6j/Z47LJIfCXe6a7RJF6WCmor8gF1pX6FO1Lw5EU jYnYJh0ZClPt3KbXZSo/35olXKbzBIxtILxz6lpmfZHFUDSKbzXs+LvzuWiGAOtLf5U6 dN6ShGtw83BqgT6xjbQ9qsIschZFgacX9Lb3YUfJTpz8Ncx8vLEmRC5KdwGQVo5Onrc2 01DwQDEyxxDioTxMgBuHnb9JQ7NtonByoChwbUHPSveKxogmFy6rm7ELx5yZTIT+s5of 8RvQ== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=5Rb3pA0PCvsc305Pcy64NG5Gmgb+aZXeKH7pH4/XWy8=; b=aPVC6zZld0iKsOiI8yMmTCcqZKPe/vL7y3HFCK/9Xs4x3IvKrlS87ScquKPfT8pku0 0/FCaAeKyw2dwhWPStxqWXc6c/5V2LIfLek3r48LZPgZph2HrlVA0qbaSC0RP1P9iZXb xfpt7VJZ5rkMLMgFzNba3M4xi0D3gSIfPSVfnOjAbYWgqApywK4GVYsMjoex5auxKIxm LEoGGOmQNuDFi/fYY6EaevgKAH0fLhjwr0AF8MERtqTFPJCteVFBYW2ZeINIVS9JdhaQ B0jEHvoCpf/4JBKyw7XDVRpcTJCtyMsRr01kTY7VgXgyomNxblRB2CTaT/w9oT7f8EMq 4mPg== X-Gm-Message-State: AOAM532s5dA+5CXpkTUmvSdUKQq+VJmZPZaBSznRGyBTgB9a38TGIGit ThqGyiKZQLkgk0F6JArNSCp0iA== X-Google-Smtp-Source: ABdhPJwUfRqL6MR+KIREAp04GPPd3vqS4pu69NrP6hW3gTOPli2Q0AAxs66O2i59jkn6t/nKr3UlXg== X-Received: by 2002:a05:6602:2ac8:: with SMTP id m8mr332814iov.46.1603231279629; Tue, 20 Oct 2020 15:01:19 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id s127sm7954ilc.66.2020.10.20.15.01.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Oct 2020 15:01:18 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id E12C3800773; Tue, 20 Oct 2020 17:01:16 -0500 (CDT) Date: Tue, 20 Oct 2020 17:01:16 -0500 From: Justin Pryzby To: Tom Lane Cc: Alvaro Herrera , pgsql-hackers@postgresql.org, Amit Langote Subject: Re: CREATE TABLE .. PARTITION OF fails to preserve tgenabled for inherited row triggers Message-ID: <20201020220116.GH9241@telsasoft.com> References: <20201020190420.GA18579@alvherre.pgsql> <674284.1603223790@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <674284.1603223790@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 Tue, Oct 20, 2020 at 03:56:30PM -0400, Tom Lane wrote: > Alvaro Herrera writes: > > Hmm, next question: should we backpatch a fix for this? (This applies > > all the way back to 11.) If we do, then we would change behavior of > > partition creation. It's hard to see that the current behavior is > > desirable ... and I think anybody who would have come across this, would > > wish it behaved the other way. But still -- it would definitely be a > > behavior change. > > The behavior change seems like it'd be an improvement in a vacuum, > but I wonder how it would interact with catalog contents left behind > by the old misbehavior. Also, would we expect pg_dump to try to do > anything to clean up the mess? If so, allowing a back branch to have > had more than one behavior would complicate that greatly. I don't think there's a problem with catalog content ? I think it's fine if there's an enabled child trigger inheriting from a disabled parent? This changes the initial tgenabled for new partitions. The old catalog state is still possible - it's what you'd get if you did CREATE TABLE child PARTITION OF..; ALTER TABLE child DISABLE TRIGGER. I don't think pg_dump needs to do anyting special, since the restore will now do what's wanted without added commands. Note that pg_dump switched from "PARTITION OF" to "ATTACH PARTITION" at commit 33a53130a. This would handles both on the server side. However...it looks like pg_dump should ALTER the child trigger state if it differ from its parent. Or maybe it needs to CREATE child triggers with the proper state before attaching the child table ? -- Justin