public inbox for [email protected]  
help / color / mirror / Atom feed
From: Dimitrios Apostolou <[email protected]>
To: [email protected]
Subject: TRUNCATE ONLY with foreign keys and triggers disabled
Date: Mon, 14 Apr 2025 12:57:04 +0200 (CEST)
Message-ID: <[email protected]> (raw)

Hello list,

While doing TRUNCATE ONLY I get:

   ERROR: cannot truncate a table referenced in a foreign key constraint

But in my case the table to be truncated is already empty, and the 
TRIGGERS are disabled in all tables.

I wonder, is there a deeper reason for this error, or is it just an 
implementation shortcoming? In other words, how easy would it be to write 
a patch that allows TRUNCATE even with foreign keys when triggers are 
disabled or the table is empty?

Thanks in advance,
Dimitris







view thread (2+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: TRUNCATE ONLY with foreign keys and triggers disabled
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox