
> > You were talking about the "select only" case (and no for update eighter). 
> > I think that select statements need a shared lock for the duration of their 
> > execution only.
> 
> You seem to think that locks on individual tuples conflict with
> table-wide locks.

Yes, very much so. Any other way would be subject to the same quirks 
you would like to avoid, no ?

>  AFAIK that's not true.

well, imho room for improvement.

> The only way to prevent
> another xact from gaining AccessExclusiveLock on a table is to be
> holding some lock *on the table*.

Yes, and holding a row exclusive lock must imho at least grab a shared
table lock (to avoid several problems, like missing an index update,
inserting a null into a newly added not null column ...).
Alternately the table exclusive lock could honour row locks 
(probably not possible, since we don't track those do we ?).

> As for your claim that read-only xacts don't need to worry about
> preventing schema updates, what of adding/deleting ON SELECT rules?

Well, depends on what that rule does, you mean a new rule ?
Ad hoc I don't see a problem based on the idea that all modification gets 
appropriate locks.

Andreas

Mon, 23 Oct 2000 17:00:27 +0200
Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>
AW: AW: AW: AW: relation ### modified while in use 
Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at> writes:
> Yes, and holding a row exclusive lock must imho at least grab a shared
> table lock

As indeed it does.  Our disagreement seems to be just on the point of
whether it's safe to allow a read-only transaction to release its 
AccessShareLock locks partway through.

My opinion about that is colored by the known bugs that we have because
the parser/rewriter/planner currently do just that.  You can cause the
system to become mighty confused if the report of a table schema change
arrives partway through the parse/plan process, because decisions
already made are no longer valid.  While we can probably patch the holes
in this area by holding a lock throughout processing of one statement,
I think that will just push the problem up to the application level.
How many apps are likely to be coded in a way that will be robust
against intra-transaction schema changes?

			regards, tom lane

Mon, 23 Oct 2000 11:44:44 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: AW: AW: AW: AW: relation ### modified while in use 