am Fri, dem 13.04.2007, um 4:27:34 -0700 mailte Carlos Santos folgendes:
> How can I know if a row is locked by another transaction.
> I have in a transaction like that:
>
> BEGIN;
> SELECT * FROM compels.teste WHERE id = '1' FOR UPDATE;
>
> PS1: where id is the primary key.
> PS2: The COMMIT command is done after a long time.
>
> In this case the row with the primary-key equals to '1' will be locked to other
> transactions until the COMMIT command be executed.
> So, how can I detect if this row is locked?
You can call the insert with 'for update nowait' and catch the error, if
an error occurs.
Maybe there are better solutions...
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net