Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iVkEZ-0005rB-K8 for pgsql-general@arkaria.postgresql.org; Fri, 15 Nov 2019 22:38:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iVkEV-0003fa-N9 for pgsql-general@arkaria.postgresql.org; Fri, 15 Nov 2019 22:38:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iVkET-0003fT-Jk for pgsql-general@lists.postgresql.org; Fri, 15 Nov 2019 22:38:27 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iVkEM-00018Z-8a for pgsql-general@postgresql.org; Fri, 15 Nov 2019 22:38:24 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 1A1CF21FB7; Fri, 15 Nov 2019 17:38:17 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 15 Nov 2019 17:38:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=E SHANMwPGg9ciGU+ug4AnSYdHFIFcU4kRpfgnH7DkXg=; b=tXwKoHVTNzhbQOJCs XoSaS6Fqo9eb7wDXrO5pUvMayDXN4bGalHJ1eg9WwMG0IdtOBwF001cL1ro2mzRQ S4W/V7VYPKMsS67K/P+QtwZP1Mm8rUi9726DMuLLOiQfR6Xia+oKIAquqmxsN2RC RFpZXS31rqHTsD5tQh97S4T9AYqJW4qda6p0K1R77QwwwohSMphJrOzaWaKuowHg HmtsaZJy2z4RbK+OAqjjT60FeQ6LCG2U00I5cNlEBePAViA3nTXib9aI7t+J/jcj 6I9kV5SzDEtUcUZXKOXmxbWt3vmJwaMB3u8PoumXiWAbxs1QonYkAOSXv75Z6xYS ZVWwQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=ESHANMwPGg9ciGU+ug4AnSYdHFIFcU4kRpfgnH7Dk Xg=; b=iDpYoEoToaHPxUmManNby1YEStlCAQJJyy2CdrGx0XD4q6vwdri695idF HHQ/Qf1mZK1pqYqWQfk/xhI9uOrDeUZbKvC+qfNN1O7zJ9JSaHlg0uSn67MzdFn2 CBX0VDSD3BRv0CY+rOv9BL3Bvn0bKuShVtLVwikl16dJdgWLfx3S/zK7uGdFIGvI 60Zd0VM2i1CKsD/AwPn47AudWOdgU2fe6c3zP4wl6NJGIPbUjHvXq0EJgKFcGnw0 EPh1QfGxlqd1Bui9fl2gscHc0nRRPe+ov3q1ZSPc9PPlMigK69Ms8FnFItp077wo 0hdowXDYDMSZZ42lXUoKFkowqzQbg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudefhedgudeigecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeehnecuhfhrohhmpeetughr ihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtg homheqnecukfhppeejfedrvdefledruddujedrvdefkeenucfrrghrrghmpehmrghilhhf rhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhenucevlhhush htvghrufhiiigvpedt X-ME-Proxy: Received: from ranger.suse (c-73-239-117-238.hsd1.wa.comcast.net [73.239.117.238]) by mail.messagingengine.com (Postfix) with ESMTPA id C6AED3060061; Fri, 15 Nov 2019 17:38:15 -0500 (EST) Subject: Re: access to original-statement predicates in an INSTEAD-OF row trigger To: John Lumby , pgsql general References: <8abf71b6-26b0-3d7e-f02c-9c33f323d792@aklaver.com> From: Adrian Klaver Message-ID: <6ea3b732-1f37-41c9-29a1-65f3aaebb6cd@aklaver.com> Date: Fri, 15 Nov 2019 14:38:14 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 11/15/19 1:54 PM, John Lumby wrote: > Adrian Klaver wrote : >> >> Seems you are looking for Serializable Isolation Level: >> > > True ,   that would solve the race condition,  but it is too drastic. > We need to run with Read Committed. > > I am looking for a solution which does not alter the application or > overall behaviour, > but just addresses detecting which predicates to apply in some way. Not sure how that could be pulled off with Read Committed as it would involve predicting the future from the POV of the transaction. > > Cheers,  John > -- Adrian Klaver adrian.klaver@aklaver.com