Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g2DJl-0004my-Qo for pgsql-docs@arkaria.postgresql.org; Tue, 18 Sep 2018 10:33:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g2DJj-0000Wh-MK for pgsql-docs@arkaria.postgresql.org; Tue, 18 Sep 2018 10:33:15 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g2DJj-0000Wa-DB for pgsql-docs@lists.postgresql.org; Tue, 18 Sep 2018 10:33:15 +0000 Received: from mo20.mail-out.ovh.net ([178.32.228.20]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g2DJf-0006k8-RR for pgsql-docs@lists.postgresql.org; Tue, 18 Sep 2018 10:33:14 +0000 Received: from EX2.emp.local (gw1.pro1.mail.ovh.net [79.137.0.65]) by mo20.mail-out.ovh.net (Postfix) with ESMTPS id BDEC355D30 for ; Tue, 18 Sep 2018 12:33:07 +0200 (CEST) Received: from DAG3EX1.emp.local (172.16.2.5) by EX2.emp.local (172.16.2.2) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1531.3; Tue, 18 Sep 2018 12:33:07 +0200 Received: from [192.168.1.24] (90.119.174.156) by DAG3EX1.emp.local (172.16.2.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1531.3; Tue, 18 Sep 2018 12:33:06 +0200 From: Adrien NAYRAT Subject: Mention FK creation take ShareRowExclusiveLock on referenced table To: Message-ID: Date: Tue, 18 Sep 2018 12:32:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US-large Content-Transfer-Encoding: 7bit X-Originating-IP: [90.119.174.156] X-ClientProxiedBy: EX2.emp.local (172.16.2.2) To DAG3EX1.emp.local (172.16.2.5) X-Ovh-Tracer-Id: 15304075959853939396 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtjedrkeeigddvjecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecu List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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,