Re: TODO-Item: TRUNCATE ... CASCADE

From: Joachim Wieland <joe(at)mcknight(dot)de>
To: pgsql-patches(at)postgresql(dot)org
Cc: alvherre(at)commandprompt(dot)com
Subject: Re: TODO-Item: TRUNCATE ... CASCADE
Date: 2006-02-03 12:05:24
Message-ID: 20060203120524.GA3402@mcknight.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)mcknight(dot)de
C/ Usandizaga 12 1°B ICQ: 37225940
20002 Donostia / San Sebastian (Spain) GPG key available

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Mark Woodward 2006-02-03 13:05:48 Re: Multiple logical databases
Previous Message Kris Jurka 2006-02-03 11:18:24 win codepages 1253, 1254, 1255, 1257 and cleanup