Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ezL6I-0007MF-HN for pgsql-general@arkaria.postgresql.org; Fri, 23 Mar 2018 11:43:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ezL6H-0003SP-Ft for pgsql-general@arkaria.postgresql.org; Fri, 23 Mar 2018 11:43:13 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ezL6H-0003SE-2P for pgsql-general@lists.postgresql.org; Fri, 23 Mar 2018 11:43:13 +0000 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ezL6D-0001Pc-Gx for pgsql-general@postgresql.org; Fri, 23 Mar 2018 11:43:11 +0000 Received: by mail-pl0-x243.google.com with SMTP id m22-v6so7259663pls.5 for ; Fri, 23 Mar 2018 04:43:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:date:in-reply-to:references:mime-version :content-transfer-encoding; bh=fQrpjyK5vL88bMCATbh+iRjiNEpwEZQwehXFn/DGHZA=; b=h56AgArqGJMywL3wygU9e9PYu3hluCJN6Ry7Ubz5y2c8SOHtcUdaskOq/tZFamIW1y DWkXaSNqqQLnh0D/FCf3tXofnQeH8NZ+VyH2PHsPsJSwd+INzUCf7wMA++e0SNu9jsbl FSc8HEJKnO5PRfjvQsOr6x8WjhZ4nqE0WIUv2JB5bT837qicjQsdw3AKq+/KwbbIDuIE Jr1YRzQDhiXk3boJyDEQXMngKIWWoO1zyDSKj1rvRvQjW5baWQdluF30WiF7fdKw48hq VFJ6AmD03l1U9qB8i/PFEo9tUA2ev+Ip0qD1vlQU25Ppsk8WbYbqvD7ah8GhkgIahLF3 Ouow== 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:mime-version:content-transfer-encoding; bh=fQrpjyK5vL88bMCATbh+iRjiNEpwEZQwehXFn/DGHZA=; b=UQmwmx4uxqPq1qt/5PVI3oQXDvp7Bio/XnTYFd2jxiYmXJRoakyj61DFcavSLWJ1i7 GonIj5Ni3rE9XJoT2mkgoz/6zEm5k0tQ1paluuEQrpqIVX+988pTPnObL7OoTjmgpxpR Q/9erkbSmFXmu96MSMCJEifrmUckGlokI+yTyRieIjvTydyoBqNfyY6C+psYZq3Ni3rx SSsvt/cdU9WF/kyvg/cnfo+SDlpYUlI+gvr7SE7o7OH1lEmatvW7Bmxc1rTyLWjhpN6w JfleTQgNAyoFr4acwu/RjFInUS2u9egNM0Y3X4y8hQm2z3TosxLzMt62yrEbQ/TS/qw1 1CZg== X-Gm-Message-State: AElRT7HYjbUM7gvwbTETd9cKt8nuC21/YcUD+TLyxKBmiDiZbs0UGQpK SG3nGaP8QIQgNOSxXEPwhQciHA== X-Google-Smtp-Source: AG47ELu0PsAurBS4xcncqwcZeVkLiNkjJa9E35uH5LloLuy4RhH+In04IR2lXcs0MzfPSEWbIpzoQA== X-Received: by 2002:a17:902:b20f:: with SMTP id t15-v6mr29145269plr.349.1521805387253; Fri, 23 Mar 2018 04:43:07 -0700 (PDT) Received: from roblaptop (d49-188-3-97.sun1.vic.optusnet.com.au. [49.188.3.97]) by smtp.gmail.com with ESMTPSA id r75sm15082520pfb.157.2018.03.23.04.43.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 23 Mar 2018 04:43:06 -0700 (PDT) Message-ID: <1521805381.3002.8.camel@gmail.com> Subject: Re: Foreign Key locking / deadlock issue.... v2 From: rob stone To: HORDER Phil , pgsql-general Date: Fri, 23 Mar 2018 22:43:01 +1100 In-Reply-To: <58cedd8d051e40bb887b4a19941b9e5b@XEXWIN0001.one-02-priv.grp> References: <2d10a11d4b624988a21133d218a95c19@XEXWIN0001.one-02-priv.grp> <1521717063.3546.3.camel@gmail.com> <58cedd8d051e40bb887b4a19941b9e5b@XEXWIN0001.one-02-priv.grp> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.2-1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello Phil, I've run your sample script on 9.6.5 and 10.3. The only thing that I added was a commit; after the initial inserts just to ensure the rows were saved. No errors were reported for either version. The output of \dp after running was:- Access privileges Schema | Name | Type | Access privileges | Column privileges | Policies --------+------+-------+-------------------+-------------------+------- ----------- public | eln | table | | | public | pl | table | | | security_policy:+ | | | | | (u): true --> including the FOR ALL in the create policy statement as well as WITH CHECK(true). Access privileges Schema | Name | Type | Access privileges | Column privileges | Policies --------+------+-------+-------------------+-------------------+------- ----------- public | eln | table | | | public | pl | table | | | security_policy:+ | | | | | (u): true + | | | | | (c): true The only mystery is what happens here:- -- …. Pause while other processing happens ….. (commit;) -- Child table processing – occurs often & quickly. Starts after parent update. <\snip> I'd like to know more about RLS and trying to de-bug your script. On a production application you'd be testing for errors and raising exceptions so as to inform users that a problem occurred. So, without knowing what occurs during "Pause while other processing happens" I can't help any further. Cheers, Rob