Re: How can I set a timeout for a locked table in Function ?

2020-01-04 Thread Jeff Janes
On Fri, Jan 3, 2020 at 1:05 PM Thomas Kellerer wrote: > Michael Lewis schrieb am 03.01.2020 um 18:00: > > > Why take an exclusive lock on an entire table to update a single row? > > That's what I was asking myself as well. > Note that the code takes "row exclusive", not "exclusive". It is seve

Re: How can I set a timeout for a locked table in Function ?

2020-01-03 Thread Thomas Kellerer
Michael Lewis schrieb am 03.01.2020 um 18:00: Why take an exclusive lock on an entire table to update a single row? That's what I was asking myself as well.

Re: How can I set a timeout for a locked table in Function ?

2020-01-03 Thread Michael Lewis
I would not think that behavior would extend to lock_timeout based on the explanation on stackexchange. I would assume that the potentially long runtime in this function is mostly in acquiring the lock and not doing the update given the implied primary key in the where clause, so perhaps lock_timeo

RE: How can I set a timeout for a locked table in Function ?

2020-01-03 Thread Patrick FICHE
Hi, You cannot set the statement_timeout within a function. You have to set it before you call the function. For example, you can try : BEGIN; SET LOCAL statement_timeout = 6000; SELECT * from public.”testlock”(); COMMIT; The reason why is explained in this post : https://dba.stackexchange.c