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 1u4LVd-000xWR-NJ for pgsql-general@arkaria.postgresql.org; Mon, 14 Apr 2025 15:14:06 +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 1u4LVb-0021TV-Vk for pgsql-general@arkaria.postgresql.org; Mon, 14 Apr 2025 15:14:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u4LVb-0021TN-2D for pgsql-general@lists.postgresql.org; Mon, 14 Apr 2025 15:14:04 +0000 Received: from fout-a1-smtp.messagingengine.com ([103.168.172.144]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u4LVX-00039L-1q for pgsql-general@lists.postgresql.org; Mon, 14 Apr 2025 15:14:03 +0000 Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfout.phl.internal (Postfix) with ESMTP id 35A091380226; Mon, 14 Apr 2025 11:13:58 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Mon, 14 Apr 2025 11:13:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1744643638; x=1744730038; bh=ez1XXFe0ZdQJspt394auNEUEccveLr8/FHf8ChL5vlY=; b= Wgt2NCC2pmWcokL2RwHgkjAcx7vCGCX6fsZKpZwyiPaoJPfFbDtpwlIQASpGZZgF qwLm4v+3fq038LXrGPxPq5iPlZe6YHfiobP66p7+FBKwVgqc7w20jOR9o6N6sOig Go5P+HEBLGP0iDZhY+kLRVDqaTW+AARlQkpQjzkWA/sPdtunFa79mrc2utEXxjNl STb+o5Hh3oAlzgqKC6WoKaPfw9MpYs8UUpeQs02KPjZ7l6TB0jVGnkPVmtBlX40D gVf/lcCn76TdtipiBarPurzcS1it14SRK6joJEZG2/1E9u/Eh61HS9YTVmaElbpN LPRFSej3TE0rKga3S2AJbQ== 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 :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1744643638; x= 1744730038; bh=ez1XXFe0ZdQJspt394auNEUEccveLr8/FHf8ChL5vlY=; b=l gZSIJq0/88v+NNRa8hH9iJxI6HkLIl9GDOltan6klgwuH6Q3J1BB/IPCDPuKkDVj FcQPqmcmMhA7TqQZVe2TTEHg6YJ2r8qu/PMair0U8wFqTan8PXLNKVgype+/S5tm vD0FkCp7uPnYcAvSw2KDQntqBLsxGzpdrsR18QOy5WN8L3ci2yu1GIQ9xcGICXze la26aMwbN4TzQ1wuXQWUl5v9iUE5hEPdYv2Rpgku+l8dWBuX4LOjjqTUmZdNJyCv GBEHNLc55sXpexg4KLvrqv/56wIKDAM20wy8L+p0eqDFI45PiBT+tkyLiQGw2xwp 9KsqA1D75Hx/gGeWMIukQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvvddtkeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddt vdejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvh gvrhesrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepuedufeejjefggfdt tdeghefgkeeuveekkeeiteettdekffehiedvtefhveffgeeunecuffhomhgrihhnpehpoh hsthhgrhgvshhqlhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhep mhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmpd hnsggprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehlrghu rhgvnhiirdgrlhgsvgestgihsggvrhhtvggtrdgrthdprhgtphhtthhopehjihhmihhsse hgmhigrdhnvghtpdhrtghpthhtohepthhglhesshhsshdrphhghhdrphgrrdhushdprhgt phhtthhopehpghhsqhhlqdhgvghnvghrrghlsehlihhsthhsrdhpohhsthhgrhgvshhqlh drohhrgh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 14 Apr 2025 11:13:57 -0400 (EDT) Message-ID: Date: Mon, 14 Apr 2025 08:13:56 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: TRUNCATE ONLY with foreign keys and triggers disabled To: Laurenz Albe , Dimitrios Apostolou , Tom Lane Cc: pgsql-general@lists.postgresql.org References: <1257959.1744641901@sss.pgh.pa.us> <6776dc7beaf591a684d089db4c77407b7a2866c4.camel@cybertec.at> Content-Language: en-US From: Adrian Klaver In-Reply-To: <6776dc7beaf591a684d089db4c77407b7a2866c4.camel@cybertec.at> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 4/14/25 08:07, Laurenz Albe wrote: > On Mon, 2025-04-14 at 17:05 +0200, Dimitrios Apostolou wrote: >> I meant the *referencing* table has just been >> populated. I'm trying to delete the *referenced* table and I get the >> error. > > That would break the foreign key constraint, right? > PostgreSQL cannot allow that. I believe the OP is disabling all triggers including system ones if I follow correctly and possibly running a foul of; https://www.postgresql.org/docs/current/sql-altertable.html " 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." > > Yours, > Laurenz Albe > > -- Adrian Klaver adrian.klaver@aklaver.com