Skip site navigation (1) Skip section navigation (2)

Re: TODO-Item: TRUNCATE ... CASCADE

From: Joachim Wieland <joe(at)mcknight(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org, alvherre(at)commandprompt(dot)com
Subject: Re: TODO-Item: TRUNCATE ... CASCADE
Date: 2006-02-05 17:24:04
Message-ID: 20060205172404.GA2449@mcknight.de (view raw or flat)
Thread:
Lists: 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

In response to

Responses

pgsql-patches by date

Next:From: Stephen FrostDate: 2006-02-05 17:53:01
Subject: Re: Krb5 & multiple DB connections
Previous:From: Andrew DunstanDate: 2006-02-05 16:15:42
Subject: Re: drop if exists remainder

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group