Should we document the behaviour of TRUNCATE skipping repeated relations? - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Should we document the behaviour of TRUNCATE skipping repeated relations?
Date
Msg-id CALj2ACULUgJPt-FT-eUHC1ArKmcFX0qxEdmPFkrc2HtQ6Aa7UQ@mail.gmail.com
Whole thread Raw
List pgsql-hackers
Hi,

The TRUNCATE command currently skips processing repeated relations
(see if (list_member_oid(relids, myrelid)) continue; in
ExecuteTruncate) because the same relation can't be truncated more
than once as it will be under "use" during the txn. For instance, in
the following use cases 1) TRUNCATE foo, foo; 2) TRUNCATE foo, ONLY
foo, foo; first instance of relation foo is taken into consideration
for processing and other relation instances ( and options specified if
any) are ignored.

I feel that users should be aware of this behaviour so that they can
correct the commands if written in such a way and don't report
unexpected behaviour especially for the use cases like (2) where they
might expect ONLY foo behaviour but it is skipped by the server.
AFAICS, I don't find it anywhere in the docs, should we document it as
a note?

Thoughts?

With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: ALTER TABLE .. DETACH PARTITION CONCURRENTLY
Next
From: Amit Kapila
Date:
Subject: Re: Replication slot stats misgivings