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 1kT7VM-0002Hi-Od for pgsql-hackers@arkaria.postgresql.org; Thu, 15 Oct 2020 17:57:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kT7VL-0001AI-Kt for pgsql-hackers@arkaria.postgresql.org; Thu, 15 Oct 2020 17:57:31 +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 1kT7VL-0001AB-AQ for pgsql-hackers@lists.postgresql.org; Thu, 15 Oct 2020 17:57:31 +0000 Received: from mail-il1-x141.google.com ([2607:f8b0:4864:20::141]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kT7VI-0002sR-D5 for pgsql-hackers@postgresql.org; Thu, 15 Oct 2020 17:57:30 +0000 Received: by mail-il1-x141.google.com with SMTP id q1so5372330ilt.6 for ; Thu, 15 Oct 2020 10:57:28 -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=A3wcOd4YgyWNeFAhvGAyQbdNh2yrM9WhOQrETx6jbwM=; b=uWGRD68S1zEfvroAx492Q7h3Ea/uJIItUqLqObzmuVHRAiXy61d0U6RrZa88i2h6u4 IfyTin7q8C0TMNrEwnLHQmmOWB+J+d+YLUV0mjIetxwAUCNspycK4/XKFOmwVqQ2jvg5 4T3XAnoh+r765OeYlcfUThS76+ASuLozINrGvRKX5hY3mAWmi7nehR4D2NNjbS72S0AC PqhEGfyMTTMtbKpCUD6fYE0qvxfeyzdhYDx6gmpLrY7/X758w/8PSm6R76/RTEfvZQrN zRdU4QCIxwtIBRV7nAzzbXrTpNYMCKNxOi0mNBjuzJMZ+Wr7wbKlOeC14szHvOdL4KfS QoNg== 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=A3wcOd4YgyWNeFAhvGAyQbdNh2yrM9WhOQrETx6jbwM=; b=rTnklJbK5WUd7zocZaS16y+x7Oiqml44tJYtKML9kzAV+z1jR6MQ4djQN/7aschFa+ berSkVnzKTUtheDYUJtFH2TOU9CQHhMt+Gyj8lAsHz4gcS8nbnKwrk/PlpF5l76CPNub kGOgKAVm3EcfO64tswjD4Wz+5q99k4quR1IvyaJTyInqwHI1RoVO7JJqr/elW39XSRDQ Qns+GbbDeiwoxxVV8pJ0tcEdlPd0G7DNq9RxBoodTGHkj9tW0VJ/N8ZbKiMwMOhLPkJT QtdFmuwe8MIluKL7jp7G0rEQvTD/M8ZK+7f1PvMDd27SGP1rW2ImZYHT8YfIWDP75mAz nXPA== X-Gm-Message-State: AOAM530MBRTXlDJdsIIJ0fP/aaWCjTEJhifH5l+vlUuUU+Vb432CSh5H S/7P14tlpAPZgWcUIC1IPHtZMw== X-Google-Smtp-Source: ABdhPJwY35jFcnb+Sqa9scIjxPjRd9kHmibWAIkTNGHKujLNYXAZWyJlsbw4UAI9BnNEPkh9j9CjdA== X-Received: by 2002:a05:6e02:bc5:: with SMTP id c5mr1706694ilu.238.1602784647487; Thu, 15 Oct 2020 10:57:27 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id 18sm3099349ilg.3.2020.10.15.10.57.26 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Oct 2020 10:57:26 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 3252480084D; Thu, 15 Oct 2020 12:57:25 -0500 (CDT) Date: Thu, 15 Oct 2020 12:57:25 -0500 From: Justin Pryzby To: pgsql-hackers@postgresql.org Cc: Alvaro Herrera , Amit Langote Subject: Re: CREATE TABLE .. PARTITION OF fails to preserve tgenabled for inherited row triggers Message-ID: <20201015175724.GX9241@telsasoft.com> References: <20200930223450.GA14848@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200930223450.GA14848@telsasoft.com> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I'm hoping that Alvaro will comment on this. On Wed, Sep 30, 2020 at 05:34:50PM -0500, Justin Pryzby wrote: > 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.