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 1gumhi-0000qi-V7 for pgsql-bugs@arkaria.postgresql.org; Fri, 15 Feb 2019 23:15:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gumhh-0006fU-Id for pgsql-bugs@arkaria.postgresql.org; Fri, 15 Feb 2019 23:15:33 +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 1gumhh-0006aC-7J for pgsql-bugs@lists.postgresql.org; Fri, 15 Feb 2019 23:15:33 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gumhe-0005KQ-2e for pgsql-bugs@lists.postgresql.org; Fri, 15 Feb 2019 23:15:32 +0000 Received: from [192.168.127.1] (port=44876 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88 (FreeBSD)) (envelope-from ) id 1gumha-000PNC-CE; Fri, 15 Feb 2019 23:15:26 +0000 Received: from [127.0.0.1] (port=11605 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1gumhZ-000F26-NH; Fri, 15 Feb 2019 23:15:25 +0000 From: Andrew Gierth To: Doug Safreno Cc: Sergei Kornilov , "pgsql-bugs\@lists.postgresql.org" , Gregory Cox , Sambit Das , Vivek Kalyanaraman , Anand Parthasarathy , webapp-dev Subject: Re: Bug: Deferred FKey Check Happening on Double Update, Not Single In-Reply-To: (Doug Safreno's message of "Fri, 15 Feb 2019 14:35:23 -0800") Message-ID: <87tvh4k5m5.fsf@news-spur.riddles.org.uk> References: <2447821550216518@myt6-add70abb4f02.qloud-c.yandex.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Fri, 15 Feb 2019 23:15:25 +0000 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >>>>> "Doug" == Doug Safreno writes: Doug> Hey Sergei, Doug> Neither transaction touches FK fields - so shouldn't they both Doug> skip FK trigger check? The optimization that lets the check be skipped only applies on the _first_ modification of the row within the transaction. On the second or subsequent modifications, the code can't easily tell whether the row was inserted in the current transaction (in which case the optimization must be skipped) or just modified, so it assumes the worst. -- Andrew (irc:RhodiumToad)