Mention FK creation take ShareRowExclusiveLock on referenced table

From: Adrien NAYRAT <adrien(dot)nayrat(at)anayrat(dot)info>
To: <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Mention FK creation take ShareRowExclusiveLock on referenced table
Date: 2018-09-18 10:32:54
Message-ID: c4e8af11-1dfc-766a-c953-76979b9fcdaa@anayrat.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

Hello,

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.

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.

Regards,

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message PG Doc comments form 2018-09-18 16:10:17 Ambiguity in restore_command for recovery.conf
Previous Message PG Doc comments form 2018-09-15 11:53:47 Ambiguous usage of 'any' in explanation