]> granicus.if.org Git - postgresql/commit
Ignore inherited temp relations from other sessions when truncating
authorMichael Paquier <michael@paquier.xyz>
Thu, 27 Dec 2018 01:16:19 +0000 (10:16 +0900)
committerMichael Paquier <michael@paquier.xyz>
Thu, 27 Dec 2018 01:16:19 +0000 (10:16 +0900)
commit1e504f01da11db0181d7b28bb30cb5eeb0767184
tree5d5a1a3bfbb085b9f9bdd3291b39b26b7c6a96c7
parent8528e3d849a896f8711c56fb41eae56f8c986729
Ignore inherited temp relations from other sessions when truncating

Inheritance trees can include temporary tables if the parent is
permanent, which makes possible the presence of multiple temporary
children from different sessions.  Trying to issue a TRUNCATE on the
parent in this scenario causes a failure, so similarly to any other
queries just ignore such cases, which makes TRUNCATE work
transparently.

This makes truncation behave similarly to any other DML query working on
the parent table with queries which need to be work on the children.  A
set of isolation tests is added to cover basic cases.

Reported-by: Zhou Digoal
Author: Amit Langote, Michael Paquier
Discussion: https://postgr.es/m/15565-ce67a48d0244436a@postgresql.org
Backpatch-through: 9.4
src/backend/commands/tablecmds.c
src/test/isolation/expected/inherit-temp.out [new file with mode: 0644]
src/test/isolation/isolation_schedule
src/test/isolation/specs/inherit-temp.spec [new file with mode: 0644]