Peter Eisentraut schrieb:
> Am Donnerstag, 3. Februar 2005 16:11 schrieb Rainer Frey:
>
>>A select should not lock a table even when it is not committed.
>
>
> The SELECT obtains a read (shared) lock on the table, but the ALTER TABLE
> requires a write (exclusive) lock. This is certainly necessary because you
> don't want the structure of the table to be changed while you are reading it.
> Additionally, the locking protocol requires that all locks once obtained need
> to be held until the end of the transaction. Both of these issues together
> explain the problem you are seeing. There is nothing that can be done about
> it.
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?
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?
Rainer Frey