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

From Joachim Wieland
Subject Re: TODO-Item: TRUNCATE ... CASCADE
Date
Msg-id 20060203120524.GA3402@mcknight.de
Whole thread Raw
In response to Re: TODO-Item: TRUNCATE ... CASCADE  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: TODO-Item: TRUNCATE ... CASCADE  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
On Thu, Feb 02, 2006 at 12:34:28PM -0300, Alvaro Herrera wrote:
> > The patch also adds a function makeRangeVarFromRelId() to namespace.c
> > that I thought would be useful. I hope I didn't overlook something
> > similar that exists already.

> That's the wrong way to go about it -- better refactor the code so that
> a function gets a list of Oids instead of RangeVars, and truncates them.
> ExecuteTruncate should build the list and pass it down.

Ok. But are RangeVars deprecated in general? Is there more information
around about when to use what?


> Also I think all the involved relations should be opened and locked
> before any of them is touched (so maybe instead of passing Oids you
> should be passing Relations).

There is already the possibility to do "TRUNCATE t1, t2, t3". The patch just
adds all referencing relations as if the user had specified all of them and
then starts truncating the same way it is doing it right now. If all
relations have to be opened and locked before truncating multiple relations,
then this problem also exists in the current code.

Or are you talking about the fact that a RangeVar contains the actual name
of the relation that the user wants to truncate whereas an Oid could
possibly be changed by another backend while our backend is constructing the
list and therefore when using Oids I have to get a lock on the table earlier?


Joachim

--
Joachim Wieland                                              joe@mcknight.de
C/ Usandizaga 12 1°B                                           ICQ: 37225940
20002 Donostia / San Sebastian (Spain)                     GPG key available

pgsql-patches by date:

Previous
From: Kris Jurka
Date:
Subject: win codepages 1253, 1254, 1255, 1257 and cleanup
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Some platform-specific MemSet research