Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tx6jw-002yEm-FX for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Mar 2025 16:02:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tx6jv-006H7M-6w for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Mar 2025 16:02:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tx6ju-006H6a-OS for pgsql-hackers@lists.postgresql.org; Tue, 25 Mar 2025 16:02:54 +0000 Received: from fout-b2-smtp.messagingengine.com ([202.12.124.145]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tx6jt-0014KG-0a for pgsql-hackers@lists.postgresql.org; Tue, 25 Mar 2025 16:02:53 +0000 Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id 7008611401F8; Tue, 25 Mar 2025 12:02:52 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Tue, 25 Mar 2025 12:02:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:message-id:mime-version:reply-to:subject :subject:to:to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1742918572; x=1743004972; bh=u7PpLvfOFtPWZNJj7SrK9ZxfAuXV 7AbwPNgUMCTJ6xg=; b=MC1uKM7yAKpHHwQ3h/g5VmeH2VNwZ1o+iDbd3s0qTUfC QtvZ/nHQfqOilOBzcL8NMBATghmFEHCdgQDIpgUWhTlHFf+szaZz/sgPGjh7w+Lj HBo4FLczjBqqBp2vgJd+34aWVPDIW/RMECH5JvKyIUkefUzpGtc9uEKYFb0xkAqa Eh1CrSltWIls5cLSxoiU1wpJLP7wbvZL9PWuaS5D4UoXUh4FNWFlITPmOhKG1KnL jwCHhujW8bh8uKnwJ0NLxInMlHjjR2E6kko6JXoxxCurSkkEtLpbdcWcZdfW4cLu KJv/RwB9cCeu7plYWuh84nhCzoLvnuExFzaUjerDWQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduieeftdekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepfffhvfevuffkgggtugfgsehtkeertddttdej necuhfhrohhmpemllhhvrghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvh hhrdhnohdqihhprdhorhhgqeenucggtffrrghtthgvrhhnpeeggfelveehtdfhgfeigeei gfejieduueeijeelvddvtdekheehkeehieelffduteenucffohhmrghinhepvghnthgvrh hprhhishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrghdpnhgspg hrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepshhurhgrjhdr khhhrghrrghgvgesvghnthgvrhhprhhishgvuggsrdgtohhmpdhrtghpthhtohepphhgsh hqlhdqhhgrtghkvghrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 25 Mar 2025 12:02:51 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1742918569; bh=cIh6N5TkSa9RGd/zFg2wTlgG2Rd40NvNB+KxiIdH+9o=; h=Date:From:To:Cc:Subject:From; b=o9M+c0Hxi/AV2uk/HivE6XpPHTpmzzcff6i/hFZKro/sl41pGKj3t6cNEAUiDmqid nbKpa3nQAeNv4piSBHiFpqsKYbBe8+u46qrMYrHDMgXZzaambk5yTGPD+wAOu1sNPd p+lZ5yiwmEvIMbIRicP65Dtwbs4WjLTj9PR1DTylr+BGer5TxgO++1Bc8wC1+TgzG4 UYUv3/quNWtpUAQu6n9w9MjnD3W73MQdEYaxd1LyVcGpOTCQxVx9derJDdTqYiydS3 511npOo+PWzWE4Tuf7XOc0nuACFjAUipb18Zfrl6D3If0i1AVxCh/CJEywQakaEXZn lJx6lbILzP3Tg== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id 8B77785; Tue, 25 Mar 2025 17:02:49 +0100 (CET) Date: Tue, 25 Mar 2025 17:02:49 +0100 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: Pg Hackers Cc: Suraj Kharage Subject: simplifying grammar for ALTER CONSTRAINT .. SET [NO] INHERIT Message-ID: <202503251602.vsxaehsyaoac@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk With commit f4e53e10b6ce we introduced a way to flip the NO INHERIT bit on not-null constraints. However, because of the way the grammar dealt with ALTER CONSTRAINT, we were too blind to see a way to implement it using the existing production. It turns out that we can remove it, so the commands would be ALTER TABLE tab ALTER CONSTRAINT constr INHERIT ALTER TABLE tab ALTER CONSTRAINT constr NO INHERIT i.e. the word SET is no longer needed. Do people find this better? A proposed patch is attached. One thing not fully clear to me is that now the entry for ALTER CONSTRAINT in the sgml docs is awkward, because it describes the INHERIT flag separate from the deferrability flags. After this patch, it's a bit more obvious that the error messages we're throwing now aren't ideal: 55432 18devel 2953943=# create table foo (a int not null); CREATE TABLE 55432 18devel 2953943=# alter table foo alter constraint foo_a_not_null no inherit deferrable; ERROR: constraint "foo_a_not_null" of relation "foo" is not a foreign key constraint 55432 18devel 2953943=# create table bar (a int primary key references bar); CREATE TABLE 55432 18devel 2953943=# alter table bar alter constraint bar_a_fkey deferrable no inherit; ERROR: constraint "bar_a_fkey" of relation "bar" is not a not-null constraint -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "Saca el libro que tu religión considere como el indicado para encontrar la oración que traiga paz a tu alma. Luego rebootea el computador y ve si funciona" (Carlos Duclós)