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 1sKHX4-009GYl-UE for pgsql-bugs@arkaria.postgresql.org; Thu, 20 Jun 2024 13:08:55 +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 1sKHW4-007M5u-LY for pgsql-bugs@arkaria.postgresql.org; Thu, 20 Jun 2024 13:07:53 +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 1sKHW3-007LxX-IE for pgsql-bugs@lists.postgresql.org; Thu, 20 Jun 2024 13:07:53 +0000 Received: from fhigh4-smtp.messagingengine.com ([103.168.172.155]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sKHW1-002Fpv-Kf for pgsql-bugs@lists.postgresql.org; Thu, 20 Jun 2024 13:07:51 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfhigh.nyi.internal (Postfix) with ESMTP id CA31E11401AD; Thu, 20 Jun 2024 09:07:47 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 20 Jun 2024 09:07:47 -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:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1718888867; x= 1718975267; bh=SPO4WMgEOCg6Px9pX5obL7tHt1nuHbs5ILX/F5sG3PA=; b=s lDYhr40Q3XfjTqw7xf1QV0DDjLaZonbkcNLSMAgS3FUuzKkIh9wNXNGBMn2i+icK yN+OwvsZmby1DeuNazQ6JuRkdycQKshaw1hxNA/dAAi/sgLsV0gsrM4wf3VpuvTk 2ClNvMCEmWuJGS5bdQ7ATaov/6G8xzAWmItZe5tOMRP656o6KfvcxFbUxweIOphz ydqHFnZ7uSch2ye6SVzvu5si1Xc43VjmoE7kOqis5sCUnsKbQfa8my1oK8QFiNjr p5RM5F77735Tb1j39vWFJsakjGP6D/lXhbabq5oXR8+go7SwrU4EQ9EgVWOdHcnX 2WZ2jWCwfUhSGQpMbl0lg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfeefvddgieduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepkedthfekveduuefgueelteekgfejgeekueduudeuveeu vddufffggfetiefhvdefnecuffhomhgrihhnpehpohhsthhgrhgvshhqlhdrohhrghdpvg hnthgvrhhprhhishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 20 Jun 2024 09:07:47 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1718888864; bh=WFdR4wvMjZNy/8WQoU8zZMRufIkXZf7OtzpuVvv9d9w=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=gQ+W1a6BsR5EmbCLNXQRVtV4Vhw5ka8BPnTPHGj65EpW6yrul/LH/Noyj3pl2JdNN kO8Jip6iQ9qZ6i7VkIs4Vm6qTQ5lWBKCWVtao8IDDUG97P9LVe9cMUHktaIdcR8BfB YMUocpzDtNtyF1yjfX19xDHoP+YbDBQ3fzvmWfxIqpNgGrKT5JZQRXePgAkjgqGpVm McgqEsTJbR9FO69AAWu8/nBOQihajJi3fEizMxqy3sj9PkpRtb+5fz+zPTzPZM1PQK lXWNC40wM+cn+z2P6VlH0vAhnlALS9IKK8NyxWVtnUbwbFe/UfU3FfKsMUMfE76p+o SmcAKTTy8Jlxg== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id EAF14527; Thu, 20 Jun 2024 06:07:44 -0700 (PDT) Date: Thu, 20 Jun 2024 15:07:44 +0200 From: Alvaro Herrera To: Mujjamil k Cc: Laurenz Albe , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18516: Foreign key data integrity is not validated when reenabled the trigger on tables Message-ID: <202406201307.ojevjmezqu45@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-Jun-20, Mujjamil k wrote: > Thank you, Laurenz, for your valuable feedback. If the enabling system > trigger doesn’t check the data integrity with the parent table, then this > syntax (ALTER TABLE DISABLE/ENABLE TRIGGER *ALL*) should be removed from > PostgreSQL. Otherwise, it will create confusion for the users. Well, we're not doing that. This is documented; the page https://www.postgresql.org/docs/devel/sql-altertable.html contains, under "DISABLE/ENABLE [ REPLICA | ALWAYS ] TRIGGER", the following very explicit text: : Disabling or enabling internally generated constraint triggers requires : superuser privileges; it should be done with caution since of course the : integrity of the constraint cannot be guaranteed if the triggers are not : executed. There's a reason you were forced to become superuser in order to do this. Anytime you're forced to become superuser, you should take a step back and think carefully what you're doing. I think it's not a bad idea to suggest that we could have a new command ALTER TABLE .. DISABLE CONSTRAINT, which can be run by the table owner and paired with a later ALTER TABLE ENABLE CONSTRAINT, which verifies the constraint. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "Entristecido, Wutra (canción de Las Barreras) echa a Freyr a rodar y a nosotros al mar"