From: | Adrien Nayrat <adrien(dot)nayrat(at)anayrat(dot)info> |
---|---|
To: | Michael Paquier <michael(at)paquier(dot)xyz> |
Cc: | <pgsql-docs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Mention FK creation take ShareRowExclusiveLock on referenced table |
Date: | 2018-09-20 06:23:45 |
Message-ID: | 068af352-1ef4-77ee-4f56-3e24a1181fbd@anayrat.info |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
On 9/19/18 4:53 AM, Michael Paquier wrote:
> On Tue, Sep 18, 2018 at 12:32:54PM +0200, Adrien NAYRAT wrote:
>> A few days ago I was surprised a CREATE TABLE containing FK constraint was
>> stuck due to an automatic vacuum freeze (which took ShareUpdateExclusiveLock
>> if I remember) on referenced table.
>
> Right. See the top of vacuum_rel() where lmode is set.
>
>> After digging into the code I found theses lines in tablecmds.c :
>>
>> /*
>> * Grab ShareRowExclusiveLock on the pk table, so that someone doesn't
>> * delete rows out from under us.
>> */
>>
>> Maybe it should be documented in theses pages?
>>
>> https://www.postgresql.org/docs/current/static/sql-createtable.html
>> https://www.postgresql.org/docs/current/static/sql-altertable.html
>>
>> If you agree I can send a patch.
>
> That looks like a good idea. Are you thinking about adding a comment
> about that in "ADD table_constraint" for the ALTER TABLE page, and in
> "FOREIGN KEY" for the CREATE TABLE page?
Yes, here is the patch
Thanks
--
Adrien
Attachment | Content-Type | Size |
---|---|---|
mention_lock_fk.patch | text/x-patch | 1.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2018-09-21 06:13:52 | Re: Mention FK creation take ShareRowExclusiveLock on referenced table |
Previous Message | Neil | 2018-09-19 15:23:41 | Re: Punctuation error |