Re: TRUNCATE ONLY with foreign keys and triggers disabled - Mailing list pgsql-general

From Tom Lane
Subject Re: TRUNCATE ONLY with foreign keys and triggers disabled
Date
Msg-id 1257959.1744641901@sss.pgh.pa.us
Whole thread Raw
In response to TRUNCATE ONLY with foreign keys and triggers disabled  (Dimitrios Apostolou <jimis@gmx.net>)
Responses Re: TRUNCATE ONLY with foreign keys and triggers disabled
List pgsql-general
Dimitrios Apostolou <jimis@gmx.net> 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



pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: ICU Collations and Collation Updates
Next
From: Dimitrios Apostolou
Date:
Subject: Re: TRUNCATE ONLY with foreign keys and triggers disabled