Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1st83w-00Dn4V-3d for pgsql-general@arkaria.postgresql.org; Tue, 24 Sep 2024 16:06:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1st83v-009ulA-G1 for pgsql-general@arkaria.postgresql.org; Tue, 24 Sep 2024 16:06:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1st83u-009ul0-JZ for pgsql-general@lists.postgresql.org; Tue, 24 Sep 2024 16:06:51 +0000 Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1st83p-000rpF-9a for pgsql-general@lists.postgresql.org; Tue, 24 Sep 2024 16:06:49 +0000 Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfhigh.phl.internal (Postfix) with ESMTP id AAC80114020D; Tue, 24 Sep 2024 12:06:44 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Tue, 24 Sep 2024 12:06:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1727194004; x=1727280404; bh=vs0RXX2X0y8YKdaKtkvI/GLT8zO8uorvjvk9hFTDtxA=; b= EwndCLjSjvYz8Xv2xLtBPTdmkv96MkqEHna5+SX7dy2lMKHu9sy4mY1hIRivb7eF 2OfcS5P76waoox7KFQ/0J6ulAUXrSYrOxZOUrTLUm+Ok/bcGRaidvex844Da0aTR 3eh+3zUE1us4pW6m3HROiWfrwuT80qBCAjAlHhonOxNGadAjbeOQ9QKXykvnqA/4 wQPMkuH21qPuYJDaXQUKoKBl6PM4PS9CIWN5KU+3fi0feIUsGTy5ClwbwgaScOVy dl66z2JJllxzaSO4fC1DH69XE/Y4PELLJBhYOiJzi6V/KBQxd1UwG9JnRaI0S7fc 6tE4ZyvABHBuzsk0ZfKPwA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1727194004; x= 1727280404; bh=vs0RXX2X0y8YKdaKtkvI/GLT8zO8uorvjvk9hFTDtxA=; b=j FCxfz/blP60YX6KI/Fbc57/xCMO9bO4pdv6aSyS5Judd/CETl2mng99bZuNdovpS tV4eznS3XXDPhhxaOueX5kS/OWbndf+NFM7oLLCzznjV1xTYaXZdla2cxbtDubBs PQUsWilRi8xVXsFrNLKd5MS6fotLpHHMiI47Q5b4WVHAOexIeiLPWpHzGYgApbl6 oGPVuDQCXGwJmsGzzserW+AeTgqN2xmD+D1TIlGoekYsSlHxTJwvDmFP3hMhnWxA ICSiyDMIdgpesedumNN1379/3HBEloMDDb7U/nsbEllCETcUi56wMatUWQ7voUPp m4zFZJpzyvwfA21kWVPgg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvddtfedgfeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfg fuvfhfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghr uceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuggftrfgrth htvghrnhepleegveekkeekueeigfdtveeileeuhfefudefteekjeffkeejueejheegheeg kedtnecuffhomhgrihhnpehpohhsthhgrhgvshhqlhdrohhrghenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghr segrkhhlrghvvghrrdgtohhmpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpoh huthdprhgtphhtthhopehrohhnlhhjohhhnhhsohhnjhhrsehgmhgrihhlrdgtohhmpdhr tghpthhtohepphhgshhqlhdqghgvnhgvrhgrlheslhhishhtshdrphhoshhtghhrvghsqh hlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Sep 2024 12:06:43 -0400 (EDT) Message-ID: <0d074fba-3cd1-466e-96f3-d9b2c9c45774@aklaver.com> Date: Tue, 24 Sep 2024 09:06:43 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Repeatable Read Isolation Level "transaction start time" To: Ron Johnson , "pgsql-general@lists.postgresql.org" References: <9CEBFAC7-4372-4FF0-8124-FFFE834B03C6@gmail.com> Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 9/24/24 05:59, Ron Johnson wrote: > On Tue, Sep 24, 2024 at 8:29 AM David G. Johnston > > wrote: > > On Monday, September 23, 2024, Wizard Brony > wrote: > > https://www.postgresql.org/docs/16/transaction-iso.html#XACT-REPEATABLE-READ > > The PostgreSQL documentation for the Repeatable Read Isolation > Level states the following: > > “UPDATE, DELETE, MERGE, SELECT FOR UPDATE, and SELECT FOR SHARE > commands behave the same as SELECT in terms of searching for > target rows: they will only find target rows that were committed > as of the transaction start time.” > > What is defined as the "transaction start time?" When I first > read the statement, I interpreted it as the start of the > transaction: > > BEGIN; > SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; > > But in my testing, I find that according to that statement, the > transaction start time is actually "the start of the first > non-transaction-control statement in the transaction" (as > mentioned earlier in the section). Is my conclusion correct, or > am I misunderstanding the documentation? > > > Probably, since indeed the transaction cannot start at begin because > once it does start it cannot be modified. > > Huh? BEGIN; SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; I read it as the transaction does not start at BEGIN because if it did you could not SET TRANSACTION to change it's characteristics. The docs go into more detail: https://www.postgresql.org/docs/current/sql-set-transaction.html The transaction isolation level cannot be changed after the first query or data-modification statement (SELECT, INSERT, DELETE, UPDATE, MERGE, FETCH, or COPY) of a transaction has been executed. So: begin ; SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; SET SET TRANSACTION ISOLATION LEVEL READ COMMITTED; SET select * from csv_test ; [...] SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; ERROR: SET TRANSACTION ISOLATION LEVEL must be called before any query > > -- > Death to , and butter sauce. > Don't boil me, I'm still alive. > crustacean! -- Adrian Klaver adrian.klaver@aklaver.com