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 1kNkgk-0005sb-03 for pgsql-hackers@arkaria.postgresql.org; Wed, 30 Sep 2020 22:35:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kNkgh-0002V6-ON for pgsql-hackers@arkaria.postgresql.org; Wed, 30 Sep 2020 22:35:03 +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 1kNkgh-0002Uy-Cy for pgsql-hackers@lists.postgresql.org; Wed, 30 Sep 2020 22:35:03 +0000 Received: from mail-io1-xd2d.google.com ([2607:f8b0:4864:20::d2d]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kNkgZ-0002Cv-RZ for pgsql-hackers@postgresql.org; Wed, 30 Sep 2020 22:35:02 +0000 Received: by mail-io1-xd2d.google.com with SMTP id q4so4312771iop.5 for ; Wed, 30 Sep 2020 15:34:55 -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:mime-version:content-disposition :user-agent; bh=T8fLhCHp+Dhah38yoWGYB6e/sgF8hLb+zAWAgkG5A/g=; b=bfzouIdV8Ita9IMu/vhRpczKC0JTdJvRdDeO3CQ8JmZ+BO49+7xTjCN8kDxLT8d8ZS tDpU2pfOeboLXI/izIiXI5qlVaNzTY32fT3AqUSHgbPY9lVX/2buc02CgqMS+vMShjWL CmvOLsK5ZdFRUevwMAbcertIdTSUaDLCmc2ZhGrEw7Vq6kvRot+G86rls7zOcCBscSwR MyckCD/9/S/ewBoJ5fTcuekDYs0gPeXCL1GrdotPyDYI5an9EI0hMQZAVf4a6HwuQepj gGruz8Z10f8orXZddz7jQjyCU6q5GElYHawsEZo4qj6SusGLsCyfZlSuintcFrk9CsUc EnqA== 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:user-agent; bh=T8fLhCHp+Dhah38yoWGYB6e/sgF8hLb+zAWAgkG5A/g=; b=DGQcQmZgsQmkepXzdWynR9it2mWxb7/x6VZXI3BFbBOSH8sFZffTkvIgCGxhs0ouQ1 /SoC9i+Mo6DjYC1rhhLIlovhwfGjLMTdHsGQZGTG2LuRM6jDRcYEkgM9t9bcMLrHBqsl AVzsbmtNdXZU5waJfGJufDbDbj1ocgdGrijLMeXrDLTHCwMLwxknHEIhJS6OUyQhNSp6 UuG5pzzgc7myZJgQAWVYMaTv+7g2HFv6DtuKSiF0JpAv23BJ3ujemRy2UbZyjXupLpPI Dea5eGm8A4xPfOna81ANY0R7RPlDRZov2pvbgKBnjHjJDGlcA/hs4isUp+OertmV6C+H g28w== X-Gm-Message-State: AOAM5304hTp5is6ZJRV8MkapNXdOAWK5FuV+pOqCv/A+/wwkNMb0LTpy vtxb+R9GfKOHj7WphVFlDlPlWA== X-Google-Smtp-Source: ABdhPJwdTVAJIAqwpjSZHo1obupYW2U7I2aany0WuOTrPLDvMGuu4nIjX5gChOc9PGsv+DYR7hcChg== X-Received: by 2002:a05:6638:240d:: with SMTP id z13mr3823775jat.7.1601505293412; Wed, 30 Sep 2020 15:34:53 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id a21sm1225027ioh.12.2020.09.30.15.34.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Sep 2020 15:34:52 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 7A2AB800B3F; Wed, 30 Sep 2020 17:34:50 -0500 (CDT) Date: Wed, 30 Sep 2020 17:34:50 -0500 From: Justin Pryzby To: pgsql-hackers@postgresql.org Cc: Alvaro Herrera , Amit Langote Subject: CREATE TABLE .. PARTITION OF fails to preserve tgenabled for inherited row triggers Message-ID: <20200930223450.GA14848@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk CREATE TABLE t(i int) PARTITION BY RANGE(i); CREATE TABLE t1 PARTITION OF t FOR VALUES FROM (1) TO (10); CREATE OR REPLACE FUNCTION tgf() RETURNS trigger LANGUAGE plpgsql AS $$ begin raise exception 'except'; end $$; CREATE TRIGGER tg AFTER INSERT ON t FOR EACH ROW EXECUTE FUNCTION tgf(); ALTER TABLE t1 DISABLE TRIGGER tg; INSERT INTO t VALUES(1); -- inserts when trigger is disabled: good ALTER TABLE t DISABLE TRIGGER tg; CREATE TABLE t2 PARTITION OF t FOR VALUES FROM (10) TO (20); postgres=# SELECT tgrelid::regclass, tgenabled FROM pg_trigger WHERE tgrelid::regclass::text IN ('t1','t2'); tgrelid | tgenabled ---------+----------- t1 | D t2 | O (2 rows) I consider this a bug,but CreateTrigStmt doesn't have any "enabled" member (since it's impossible to CREATE TRIGGER .. DISABLED), so I'm not sure where the fix should be.