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 1ljkzZ-0005qU-H7 for pgsql-hackers@arkaria.postgresql.org; Thu, 20 May 2021 15:53:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ljkzY-000373-Gk for pgsql-hackers@arkaria.postgresql.org; Thu, 20 May 2021 15:53:44 +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 1ljkzY-00036I-8z for pgsql-hackers@lists.postgresql.org; Thu, 20 May 2021 15:53:44 +0000 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ljkzW-0007Vo-1g for pgsql-hackers@lists.postgresql.org; Thu, 20 May 2021 15:53:43 +0000 Received: by mail-wr1-x436.google.com with SMTP id n2so18271100wrm.0 for ; Thu, 20 May 2021 08:53:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=cybertec.at; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=CmvID4/d0QqSwOnFd1aPC1VnDIq2hw/3z8tX5nV0Z3w=; b=bCgSoaSSsj78yTTaZTZJcNGqUTgHiakFUaqoxo1IHjJywqHCZHlKo6hBZ9mcvxdElT 5Bh3Uks7lr8fuNeaMWIInAUaq6cy02CvShWGGcjQeIenHgUv8G6PJSVcFGhB9EaI7Z+1 9IQaqnDh6xg+zIWCNvCkM1uek2Zhx0kha1RiQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=CmvID4/d0QqSwOnFd1aPC1VnDIq2hw/3z8tX5nV0Z3w=; b=jH7AMprOQoZ00kZjFLmziNKKgMXb2Y+JL5e+gva2YTQjvtZyUAHUzZ56fBUX3ZK24p Nj46XX3hnBfy4CeClVaFdNhvf32lWygfEd7mZwWjHhxYEDfl2RVqfSXsdpLhtOkKH/Pb U39duqVxPGs5o11jbnOL32ZXGzsxYRgYkV8aZlStyNtQIRFQp85UFOVingfnLl4pGnDG HjMjoiGaWJxlyZ+WuOLOlZvtUz6nR073PMr4wOWTNG3RLesdw7tGY5i6kAlDoZAxyncR IZKl7KuwunrGGQ0ALmLpDg7qo/fX8E8x8POXrBrbfuH2CzZyh/kH4uxm+6ljtonBIjq1 7qeA== X-Gm-Message-State: AOAM532QiiA7hVhpeScP3LmEHNcdZA1CT/+vMGKYIXwVgyp7P0xo6rpW SlHPZqTEMlg8qfq8B9I/3edtE+6M0x/0/w== X-Google-Smtp-Source: ABdhPJySZhIciNGqfcMIZKJq15eyQ/7Bw+ddKYRB6UZK6zFXXx6lZZEbPVHrIIZvTzQ7Xkzg0w5hYQ== X-Received: by 2002:adf:f341:: with SMTP id e1mr3490971wrp.352.1621526021439; Thu, 20 May 2021 08:53:41 -0700 (PDT) Received: from localhost.localdomain (217-149-171-186.nat.highway.telekom.at. [217.149.171.186]) by smtp.gmail.com with ESMTPSA id h9sm3081883wmb.35.2021.05.20.08.53.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 08:53:41 -0700 (PDT) Message-ID: <4ca26d9c2e7ce620236dd69f3eb746fc2dbcafb4.camel@cybertec.at> Subject: Re: Clarify how triggers relate to transactions From: Laurenz Albe To: him@nathanmlong.com, pgsql-hackers@lists.postgresql.org Date: Thu, 20 May 2021 17:53:40 +0200 In-Reply-To: <62219f2ce78faf09687d998f347c518b3c08d067.camel@cybertec.at> References: <161953360822.695.15805897835151971142@wrigleys.postgresql.org> <1a565681fe54535d69e6418ef5ab55405b92beac.camel@cybertec.at> <62219f2ce78faf09687d998f347c518b3c08d067.camel@cybertec.at> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 2021-05-05 at 11:55 +0200, Laurenz Albe wrote: > On Wed, 2021-04-28 at 13:24 +0200, Laurenz Albe wrote: > > On Tue, 2021-04-27 at 14:26 +0000, PG Doc comments form wrote: > > > https://www.postgresql.org/docs/current/sql-createtrigger.html mentions the > > > word "transaction" only once, in reference specifically to constraint > > > triggers: "They can be fired either at the end of the statement causing the > > > triggering event, or at the end of the containing transaction; in the latter > > > case they are said to be deferred." > > > > > > If I understand correctly, it would be helpful to add this sentence or a > > > corrected version of it: "Triggers always execute in the same transaction as > > > the triggering event, and if a trigger fails, the transaction is rolled > > > back." > > > > Good idea in principle, but I'd put that information on > > https://www.postgresql.org/docs/current/trigger-definition.html > > Here is a proposed patch for this. Replying to -hackers for the commitfest app. Yours, Laurenz Albe