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 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: primary key and unique index

2018-03-24 Thread HORDER Phil
Some databases will create a unique index for you when you create a primary key. Oracle will create one, but only if you haven’t already done that. Postgres will ALWAYS create a unique index based on the primary key – so you should never do that as well, or the db will have to maintain two

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-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-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

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