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