RE: Foreign Key locking / deadlock issue.... v2

2018-03-26 Thread HORDER Phil
psql> select version(); PostgreSQL 9.6.1, compiled by Visual C++ build 1800, 64-bit

Re: Foreign Key locking / deadlock issue.... v2

2018-03-24 Thread Adrian Klaver
On 03/24/2018 11:03 AM, HORDER Phil wrote: I'm running Postgres 9.6.1 (I think) To find out for sure do: psql> select version(); Phil Horder Database Mechanic -- Adrian Klaver adrian.kla...@aklaver.com

RE: Foreign Key locking / deadlock issue.... v2

2018-03-24 Thread HORDER Phil
upgraded lock on the PL table, caused by the RLS policy. I'm running Postgres 9.6.1 (I think) Phil Horder Database Mechanic -Original Message- From: rob stone [mailto:floripa...@gmail.com] Sent: 24 March 2018 11:30 To: HORDER Phil; pgsql-general Subject: Re: Foreign Key locking / de

Re: Foreign Key locking / deadlock issue.... v2

2018-03-24 Thread rob stone
pl.pl_id will cause an exception to occur due to the constraint. Cheers, Rob > commit; > > > -- process 2: > start transaction; > update eln set pl_id = 3 where event_id = 303; > update eln set pl_id = 2 where event_id = 302; > -- Gets blocked by pro

RE: Foreign Key locking / deadlock issue.... v2

2018-03-23 Thread HORDER Phil
it; Phil Horder Database Mechanic -Original Message- From: rob stone [mailto:floripa...@gmail.com] Sent: 23 March 2018 11:43 To: HORDER Phil; pgsql-general Subject: Re: Foreign Key locking / deadlock issue v2 Hello Phil, I've run your sample script on 9.6.5 and 10.3. T

Re: Foreign Key locking / deadlock issue.... v2

2018-03-23 Thread rob stone
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

RE: Foreign Key locking / deadlock issue.... v2

2018-03-22 Thread HORDER Phil
heck as suggested makes no difference to the demo - the blocking lock still occurs. Phil Horder Database Mechanic -Original Message- From: rob stone [mailto:floripa...@gmail.com] Sent: 22 March 2018 11:11 To: HORDER Phil; Adrian Klaver Cc: pgsql-general Subject: Re: Foreign Key loc

Re: Foreign Key locking / deadlock issue.... v2

2018-03-22 Thread rob stone
Hello Phil, On Wed, 2018-03-21 at 15:26 +, HORDER Phil wrote: > OK, > Let's try again, with a full script, and including the bit that makes > the difference… > > Hi, > I’m trying to understand why I’m getting a deadlock issue, and how to > work around it. > > At base, I think the problem

RE: Foreign Key locking / deadlock issue.... v2

2018-03-21 Thread HORDER Phil
OK, Let's try again, with a full script, and including the bit that makes the difference… Hi, I’m trying to understand why I’m getting a deadlock issue, and how to work around it. At base, I think the problem is: 1.Updates to a parent table are creating row level write

RE: Foreign Key locking / deadlock issue.

2018-03-21 Thread HORDER Phil
Apologies, I committed the heinous crime of not creating a full working demo. It seems that Row Level Security is involved - I'll post an update with full code ASAP Phil Horder Database Mechanic

Re: Foreign Key locking / deadlock issue.

2018-03-21 Thread rob stone
Hello Phil, On Tue, 2018-03-20 at 11:46 +, HORDER Phil wrote: > Hi, > I’m trying to understand why I’m getting a deadlock issue, and how to > work around it. > > At base, I think the problem is: > 1. Updates to a parent table are creating row level write > locks, > 2. updates

Re: Foreign Key locking / deadlock issue.

2018-03-20 Thread Adrian Klaver
To: HORDER Phil; pgsql-general@lists.postgresql.org Subject: Re: Foreign Key locking / deadlock issue. On 03/20/2018 04:46 AM, HORDER Phil wrote: Hi, I'm trying to understand why I'm getting a deadlock issue, and how to work around it. At base, I think the problem is: 1.Updates to a parent table

Re: Foreign Key locking / deadlock issue.

2018-03-20 Thread Adrian Klaver
On 03/20/2018 04:46 AM, HORDER Phil wrote: Hi, I’m trying to understand why I’m getting a deadlock issue, and how to work around it. At base, I think the problem is: 1.Updates to a parent table are creating row level write locks, 2.updates to a child table set the foreign key value to the

Foreign Key locking / deadlock issue.

2018-03-20 Thread HORDER Phil
Hi, I'm trying to understand why I'm getting a deadlock issue, and how to work around it. At base, I think the problem is: 1. Updates to a parent table are creating row level write locks, 2. updates to a child table set the foreign key value to the parent table, which are then