pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
re_ help lock record
2+ messages / 2 participants
[nested] [flat]

* re_ help lock record
@ 2006-05-24 12:28  bitrunner <bitrunner@katamail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: bitrunner @ 2006-05-24 12:28 UTC (permalink / raw)
  To: pgsql-jdbc

Dave wrote:

I think I understand the question. You want to know how to determine if 
the record is locked.

As far as I know there isn't a way. If process A locks the record, then 
process B attempts to lock the record it will block until process A 
releases the record.

If you have statement_timeout set to some value other than -1 then 
process B will timeout after waiting for the statement_timeout. 
Otherwise it will block until process A is finished with the record.
------------------------------------------------------------------------
yes is my problem, you have understood perfectly!!!
I have already used the statement_timeout but it does not work: it does 
not raise exception. This is my code:

          conPostgre.transactionStart();
          Statement stm = conPostgre.connection.createStatement();
          stm.setQueryTimeout(3);
          rs = stm.executeQuery("select * from prova where \"prvID\" = 1 
for update");
          System.out.println("Lock: " + rs.next());

I must set up of the parameters to postgresql.conf?

Thanks a lot.




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: re_ help lock record
@ 2006-05-24 12:42  Dave Cramer <pg@fastcrypt.com>
  parent: bitrunner <bitrunner@katamail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Dave Cramer @ 2006-05-24 12:42 UTC (permalink / raw)
  To: bitrunner <bitrunner@katamail.com>; +Cc: pgsql-jdbc


On 24-May-06, at 8:28 AM, bitrunner wrote:

> Dave wrote:
>
> I think I understand the question. You want to know how to  
> determine if the record is locked.
>
> As far as I know there isn't a way. If process A locks the record,  
> then process B attempts to lock the record it will block until  
> process A releases the record.
>
> If you have statement_timeout set to some value other than -1 then  
> process B will timeout after waiting for the statement_timeout.  
> Otherwise it will block until process A is finished with the record.
> ---------------------------------------------------------------------- 
> --
> yes is my problem, you have understood perfectly!!!
> I have already used the statement_timeout but it does not work: it  
> does not raise exception. This is my code:
>
>          conPostgre.transactionStart();
>          Statement stm = conPostgre.connection.createStatement();
>          stm.setQueryTimeout(3);
>          rs = stm.executeQuery("select * from prova where \"prvID\"  
> = 1 for update");
>          System.out.println("Lock: " + rs.next());
>
> I must set up of the parameters to postgresql.conf?

Yes, you must set this in postgresql.conf
>
> Thanks a lot.
>
>
> ---------------------------(end of  
> broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>       choose an index scan if your joining column's datatypes do not
>       match
>




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2006-05-24 12:42 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-05-24 12:28 re_ help lock record bitrunner <bitrunner@katamail.com>
2006-05-24 12:42 ` Dave Cramer <pg@fastcrypt.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox