Re: TODO-Item: TRUNCATE ... CASCADE - Mailing list pgsql-patches

From Joachim Wieland
Subject Re: TODO-Item: TRUNCATE ... CASCADE
Date
Msg-id 20060205172404.GA2449@mcknight.de
Whole thread Raw
In response to Re: TODO-Item: TRUNCATE ... CASCADE  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: TODO-Item: TRUNCATE ... CASCADE
List pgsql-patches
On Fri, Feb 03, 2006 at 10:27:30AM -0500, Tom Lane wrote:
> Basically: it's the user's fault if he says "TRUNCATE t2" in a situation
> where the referent of t2 might be changing concurrently.  But once
> you've identified t2, it's your fault if you don't track the
> dependencies of t2 correctly, even if someone else is busy renaming them.

Ok, the attached patch now does it correctly as suggested by Alvaro.

For code simplicity I changed the locking order of the tables in the
RESTRICT-case as well.
Before they got locked and then checked one by one. To simplify integration
of the CASCADE-case however, I changed it to lock all - check all.

So it is now:

CASCADE:
lock direct - add and lock cascaded tables - check all - truncate all

RESTRICT:
lock direct (= all) - check all - truncate all.


Joachim

Attachment

pgsql-patches by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: drop if exists remainder
Next
From: Bruce Momjian
Date:
Subject: Re: drop if exists remainder