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