Tom Lane wrote:
>
> Hiroshi Inoue <Inoue@tpf.co.jp> writes:
> > I like neither unexpected errors nor doing the wrong
> > thing by handling tuples which aren't guaranteed to
> > be up-to-date. After mark4update, the tuple is
> > guaranteed to be up-to-date and heap_update won't
> > fail even though some commands etc neglect to lock
> > the correspoding relation. Isn't it proper to guard
> > myself as much as possible ?
>
> If one piece of the system "guards itself" and others do not, what have
> you gained? Not much.
??? The system guarding itself won't gain bad result at least.
If one piece of system "guards others" and others do not, both
may gain bad results. Locking a class info by locking the
corrsponding relation is such a mechanism.
However I don't think we could introduce this mechanism to all
system catalogs. I implemented LockClassinfoForUpdate() by the
following reason.
1) pg_class is the most significant relation.
2) LockClassinfoForUpdate() adds few new conflicts by locking the pg_class tuple because locking the corresponding
relationlocks the pg_class entity implicitly unless some stuff neglects to lock corresponding relation.
Regards.
Hiroshi Inoue