Re: [HACKERS] question: foreign key constraints and AccessExclusive locks

2013-01-06 Thread Tom Lane
Jon Nelson writes: > On Sun, Jan 6, 2013 at 4:14 AM, Simon Riggs wrote: >> FKs are enforced by triggers currently. Adding triggers requires >> AccessExclusiveLock because of catalog visibility issues; you are >> right that a lower lock is eventually possible. > I've read and re-read this a few t

Re: [HACKERS] question: foreign key constraints and AccessExclusive locks

2013-01-06 Thread Jon Nelson
On Sun, Jan 6, 2013 at 4:14 AM, Simon Riggs wrote: > On 6 January 2013 03:08, Jon Nelson wrote: >> When adding a foreign key constraint on tableA which references >> tableB, why is an AccessExclusive lock on tableB necessary? Wouldn't a >> lock that prevents writes be sufficient, or does PostgreS

Re: [HACKERS] question: foreign key constraints and AccessExclusive locks

2013-01-06 Thread Simon Riggs
On 6 January 2013 03:08, Jon Nelson wrote: > When adding a foreign key constraint on tableA which references > tableB, why is an AccessExclusive lock on tableB necessary? Wouldn't a > lock that prevents writes be sufficient, or does PostgreSQL have to > modify *both* tables in some fashion? I'm us

[HACKERS] question: foreign key constraints and AccessExclusive locks

2013-01-05 Thread Jon Nelson
When adding a foreign key constraint on tableA which references tableB, why is an AccessExclusive lock on tableB necessary? Wouldn't a lock that prevents writes be sufficient, or does PostgreSQL have to modify *both* tables in some fashion? I'm using PostgreSQL 8.4 on Linux. -- Jon -- Sent via