Am Freitag, 4. Februar 2005 11:54 schrieb Rainer Frey:
> Thanks for the explanation, though I don't really get the necessity of a
> commit for a read-only statement. Can't a SELECT release its lock after
> it received the response?

If that is the end of the transaction, then you might as well commit it then.  
But what if you plan to do an update in the same transaction based on the 
selection results?  You can't release and reaquire locks in the same 
transaction without getting into a bunch of trouble.  Read up on "strict 
two-phase locking" if you're curious.

> Is there any possibility to set a timeout for the lock, after which the
> ALTER TABLE statement fails, instead of remaining in wait status (when
> calling with JDBC?

Yes, there is a statement_timeout parameter or something like that.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to