From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Aaron Sipser <ajsipser(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Locks on FK Tables From Partitioning |
Date: | 2022-02-08 23:13:49 |
Message-ID: | 1298506.1644362029@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Aaron Sipser <ajsipser(at)gmail(dot)com> writes:
> I am fairly confused about the locks generated by some partitioning code I
> am using. The setup is that we have a partitioned table (call it P), and it
> has a foreign key constraint to another table F. I'm trying to figure out
> why when I add partitions to P, it seems that a lock is also taken on F.
Addition of a foreign key constraint implies adding triggers to both sides
of the FK. Adding a new partition also adds a child foreign key
constraint, which I'm pretty sure requires its own trigger. So the F
table is going to need whatever lock strength is involved in CREATE
TRIGGER. I don't recall offhand what we use, but it would at least need
to block operations that might fire such a trigger.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Abhishek Bhola | 2022-02-09 08:29:54 | Why are data files getting modified? |
Previous Message | Adrian Klaver | 2022-02-08 20:26:31 | Re: Question on tablefunc extension |