Re: TRUNCATE ONLY with foreign keys and triggers disabled

2025-04-14 Thread Dimitrios Apostolou
On Mon, 14 Apr 2025, Adrian Klaver wrote: On 4/14/25 08:20, Dimitrios Apostolou wrote: On Mon, 14 Apr 2025, Adrian Klaver wrote: 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  populate

Re: TRUNCATE ONLY with foreign keys and triggers disabled

2025-04-14 Thread Adrian Klaver
On 4/14/25 08:20, Dimitrios Apostolou wrote: On Mon, 14 Apr 2025, Adrian Klaver wrote: 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 an

Re: TRUNCATE ONLY with foreign keys and triggers disabled

2025-04-14 Thread Adrian Klaver
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 al

Re: TRUNCATE ONLY with foreign keys and triggers disabled

2025-04-14 Thread Dimitrios Apostolou
On Mon, 14 Apr 2025, Adrian Klaver wrote: 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 fo

Re: TRUNCATE ONLY with foreign keys and triggers disabled

2025-04-14 Thread Laurenz Albe
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. Yours, Laurenz Albe

Re: TRUNCATE ONLY with foreign keys and triggers disabled

2025-04-14 Thread Dimitrios Apostolou
On Mon, 14 Apr 2025, Dimitrios Apostolou wrote: On Mon, 14 Apr 2025, Tom Lane wrote: Dimitrios Apostolou 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 T

Re: TRUNCATE ONLY with foreign keys and triggers disabled

2025-04-14 Thread Dimitrios Apostolou
On Mon, 14 Apr 2025, Tom Lane wrote: Dimitrios Apostolou 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

Re: TRUNCATE ONLY with foreign keys and triggers disabled

2025-04-14 Thread Tom Lane
Dimitrios Apostolou 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 t

TRUNCATE ONLY with foreign keys and triggers disabled

2025-04-14 Thread Dimitrios Apostolou
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 im