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 1g2Sc5-0005kw-Sk for pgsql-docs@arkaria.postgresql.org; Wed, 19 Sep 2018 02:53:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g2Sc4-0008Al-1f for pgsql-docs@arkaria.postgresql.org; Wed, 19 Sep 2018 02:53:12 +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 1g2Sc3-0008Ae-OL for pgsql-docs@lists.postgresql.org; Wed, 19 Sep 2018 02:53:11 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g2Sc0-00043j-Gx for pgsql-docs@lists.postgresql.org; Wed, 19 Sep 2018 02:53:10 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id A27A421F6A; Tue, 18 Sep 2018 22:53:07 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 18 Sep 2018 22:53:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=J3qcBxuoqMsMy6Z27SqYDp9SMczKen2iFFFc7C5K4Ik=; b=MJEtoeAV yMOkixUQ+dzYakGmTwTbzSEEGCYBtO3Feem+U/RDa9Sur9iNITHCv/RghmBFQafg yGPhom9ATS0lSU3Q10B7NpyPOaIrBqg29aKnAnckokjaeyoVIctIXdRWts7r552B WsiUiUMxnLrYe+FUWqGbC5JAYKcyYnI2HPr7lGCApSKJRCyte6pLo0Ds+x71EuVi ZKIfKpr4vMN7HK4Wixo4BfbsmvHFm1XV7w0MNhWKGA4mkIGfp3sgbU5WvFyswZu2 Fhd6ToDxIOMx1dFS9oizksYAK1g12//zmhL1/q0GOqSXRhXbvXPRxUAmeK1jyBDi sodsVguP/DP4Ew== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=J3qcBxuoqMsMy6Z27SqYDp9SMczKe n2iFFFc7C5K4Ik=; b=lKjyVoeLONccRfyHEyvxqyTkeMt4o9D7dJGs97brM8wJz T/bxG3IkOb6riroCfg0/NquPkz/71DqZEkMHjpXCs7pSz2WLsORliS7Tz3aR7nb3 sfy4QD6l9cfkHuUh030TAu+KyA36pCR7cFachCVc7rw11+XTstqXAzXgtkEBjb0I mXCYT7nmsdYP7aV95uae7URbuv+7KcQn3q7EZZLfncGxtI412yz6wREiqZIlzUAM 5OdePFdtIMyWz+JHwXk57AGNESehGJiJbIpmswRuAlUMO4O0az7lxmvz9NNn84WE D3mrBk5G5676bYRxWRoAYH2pVuikEkgWiuBEF4l3Q== X-ME-Proxy: X-ME-Sender: Received: from paquier.xyz (c137162.net61215.cablenet.ne.jp [61.215.137.162]) by mail.messagingengine.com (Postfix) with ESMTPA id DCBB9E4588; Tue, 18 Sep 2018 22:53:05 -0400 (EDT) Date: Wed, 19 Sep 2018 11:53:02 +0900 From: Michael Paquier To: Adrien NAYRAT Cc: pgsql-docs@lists.postgresql.org Subject: Re: Mention FK creation take ShareRowExclusiveLock on referenced table Message-ID: <20180919025302.GF1650@paquier.xyz> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="t4apE7yKrX2dGgJC" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --t4apE7yKrX2dGgJC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 ShareUpdateExclusiveL= ock > 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 : >=20 > /* > * Grab ShareRowExclusiveLock on the pk table, so that someone doesn't > * delete rows out from under us. > */ >=20 > Maybe it should be documented in theses pages? >=20 > https://www.postgresql.org/docs/current/static/sql-createtable.html > https://www.postgresql.org/docs/current/static/sql-altertable.html >=20 > 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? -- Michael --t4apE7yKrX2dGgJC Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAluhug4ACgkQnvQgOdby QH1EKRAAltU22YvPMt5be173PCJwOtxHIIDN67nlHF0L1wu2Vi79Ylk5lmftgZro /7qCFmhzkqVgPJLEj6rELOWPR75ARvrz2uiWdX+EvQCitCHhiBuf5F2Gq6lB4wdb aYo4XeH9HlPnrmR+C7dfieWuIFuG5Bd+IMj7ukXRIVWuUdw5glN3NnjenMjmid/8 Afr9zUkGLBaejTlQsCJg47OweEbQ8kM6G68RaF+iSvZ8a1iuJGiWASsHHkJZP03t MS/gJdic8nwda9Yf1JiNzbiKcuzmFeQ5nDblzkkJh3/eiNtfuJ0tFCkg9aYoGaUh y6Im0y3BTzd0MRcLuVgapipALsOesLKd+Cx1E1ze2vaFT/WxWihi90fGCPpbZoGv /K8IGyBsJGL1QhQ6J84tivCBUKR+wWd1Ys1rd9zl0wXfXEujLqF/CwdcX0oNCNUJ n32O3iKK+SzcK+2ft8/r2CG+HyLCVqJLrbf2b5XhmtVXvNZKtUxITWHwDP7LfZy0 0tKUNoKAmVwUQX0mA9q41yZOUtIce/iFcBX+IGN9SYgnCad6zG2ZVd0peN9HWQxX klutlDFoUUHfhe8lsx2Su+LiU4JMTowi32dzsNNQ1fWzRncvZd+1qaapxvsChDS1 bBM7Zi9dTt5LWRiPZCuTubi8IWDj28JcnQsM9Ng7MLLu0h4mTww= =rnLK -----END PGP SIGNATURE----- --t4apE7yKrX2dGgJC--