Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at> writes:
> No, the above is not a valid example, because Session 2 won't
> get the exclusive lock until Session 1 commits, since Session 1 already
> holds a lock on foo (for the inserted row).
> 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. AFAIK that's not true. The only way to prevent
another xact from gaining AccessExclusiveLock on a table is to be
holding some lock *on the table*.
As for your claim that read-only xacts don't need to worry about
preventing schema updates, what of adding/deleting ON SELECT rules?
regards, tom lane