public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: Dimitrios Apostolou <[email protected]>
Cc: [email protected]
Subject: Re: TRUNCATE ONLY with foreign keys and triggers disabled
Date: Mon, 14 Apr 2025 10:45:01 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

Dimitrios Apostolou <[email protected]> writes:
> 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.

IIRC, it will let you do it if you truncate both the referenced and
referencing tables in the same command.  The state of the triggers
is not material to this, since TRUNCATE doesn't fire them anyway.

			regards, tom lane






view thread (2+ messages)

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], [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