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 1oxkwg-000297-D3 for pgsql-hackers@arkaria.postgresql.org; Wed, 23 Nov 2022 08:17:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oxkwf-0004lv-4N for pgsql-hackers@arkaria.postgresql.org; Wed, 23 Nov 2022 08:17:25 +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 1oxkwe-0004lm-ND for pgsql-hackers@lists.postgresql.org; Wed, 23 Nov 2022 08:17:24 +0000 Received: from mail-qt1-x82c.google.com ([2607:f8b0:4864:20::82c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oxkwc-0004F2-Jz for pgsql-hackers@postgresql.org; Wed, 23 Nov 2022 08:17:24 +0000 Received: by mail-qt1-x82c.google.com with SMTP id a27so10783036qtw.10 for ; Wed, 23 Nov 2022 00:17:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=rwFJgSyvQh0PfFYR3BEZ+bMSbNbqgKj75nocF7CIz+Q=; b=HlB56WFk2Gi0j8t9jL+t9Urth2ednatRpmtiZzWyIcWAlxWN8GKOk+b/4ndK7ZKyGt eDkVQmpDcEHXxcrTc+S87NbN1k/pRgQLp1C3jPzllhG7hBX0HvTI3UMVu8l0MviWSPL7 +IRreSbhPSKwojPTlutoU4/tJ0kxgObKFxVISZ1nbf+ZaUtIZpaOc5Tk47CX37LdP2ju 9XFz2fL0N3rRk7/xFUAEUNrQdh6BKeJcJnGr+h9bbGcuWzkyIrZNwjyNwmXsK/gD5BN9 XHufglD8Bgg2aQ2hI6Jq5NF5jxXECJ4E9/1g4ik4LX9J6QTL5ZEQlowYt9jjaA/b/xxk eV5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rwFJgSyvQh0PfFYR3BEZ+bMSbNbqgKj75nocF7CIz+Q=; b=UpO7caJpzSZK+Kl6TA5wbIU0PGnnHJ0sxn6jKTSl/e7pCESpUafcNXX1P2QlBvr0/l l4rXC7wS3XYWJLQ3HdgWpBKaMe4XpajIbRuT6Z2Oh/Pq29VjsJ1x+29wNh7WlIhKAFG3 1yz9hnrvdJ9yxD78OUm+tC+QGl4bU9xmRSN2f4N73noj4mY7vPwLd6dqwJiLar4A2yxk koNYr8FJP6EQXji80747SWaaI/3oOrRS5lYcdn1sAcQj63PAKZFppqWZ2rqgRWSv+WdJ a3VzOGeof66EE1N8gOYEsIHIrYof+LyJq0f++mvGe9MP7u2AXDqebXYJFN21UXb2x0aH NgAA== X-Gm-Message-State: ANoB5pmx13gDmAqOzoEE/Ve0ruranb66Wkeavc9Ast+q1mHfC/1/0vSg xo7qsjzHjWNmCfNAz7CL15Khyw== X-Google-Smtp-Source: AA0mqf4gr4xAPGX90W4Ji4i+DrPr3Voi2y1oPIYyZvEDbJVFwPC2ACe4mzubCDkjzZv13KRUngy8gA== X-Received: by 2002:ac8:60d7:0:b0:3a5:2e13:bd82 with SMTP id i23-20020ac860d7000000b003a52e13bd82mr13541282qtm.480.1669191440690; Wed, 23 Nov 2022 00:17:20 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id k18-20020a05620a415200b006e54251993esm12005081qko.97.2022.11.23.00.17.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Nov 2022 00:17:20 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 259EC800CAE; Wed, 23 Nov 2022 02:17:19 -0600 (CST) Date: Wed, 23 Nov 2022 02:17:19 -0600 From: Justin Pryzby To: Bruce Momjian Cc: Erik Rijkers , Laurenz Albe , Robert Treat , Simon Riggs , Alvaro Herrera , pgsql-hackers@postgresql.org Subject: Re: New docs chapter on Transaction Management and related changes Message-ID: <20221123081718.GI11463@telsasoft.com> References: <80a5fd9c080d66e62f90c9565e3e1b54e61f584c.camel@cybertec.at> <3603e6e85544daa5300c7106c31bc52673711cd0.camel@cybertec.at> <07d63204be526d4c74c322c3f1646e76e5ba3910.camel@cybertec.at> <1806c06d-1bc2-3b44-d722-fcecf02981e0@xs4all.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Nov 22, 2022 at 01:50:36PM -0500, Bruce Momjian wrote: > + > + > + A more complex example with multiple nested subtransactions: > + > +BEGIN; > + INSERT INTO table1 VALUES (1); > + SAVEPOINT sp1; > + INSERT INTO table1 VALUES (2); > + SAVEPOINT sp2; > + INSERT INTO table1 VALUES (3); > + RELEASE SAVEPOINT sp2; > + INSERT INTO table1 VALUES (4))); -- generates an error > + > + In this example, the application requests the release of the savepoint > + sp2, which inserted 3. This changes the insert's > + transaction context to sp1. When the statement > + attempting to insert value 4 generates an error, the insertion of 2 and > + 4 are lost because they are in the same, now-rolled back savepoint, > + and value 3 is in the same transaction context. The application can > + now only choose one of these two commands, since all other commands > + will be ignored with a warning: > + > + ROLLBACK; > + ROLLBACK TO SAVEPOINT sp1; > + > + Choosing ROLLBACK will abort everything, including > + value 1, whereas ROLLBACK TO SAVEPOINT sp1 will retain > + value 1 and allow the transaction to continue. > + This mentions a warning, but what happens is actually an error: postgres=!# select; ERROR: current transaction is aborted, commands ignored until end of transaction block