FOR UPDATE SKIP LOCKED and get locked row/avoid updating other row(s)

Поиск
Список
Период
Сортировка
От Wiwwo Staff
Тема FOR UPDATE SKIP LOCKED and get locked row/avoid updating other row(s)
Дата
Msg-id CAD1W9HUrmzSRYLeBSHf3gL7G5pSW9AA5BMdYQq-rg4xK8tHe1w@mail.gmail.com
обсуждение исходный текст
Ответы Re: FOR UPDATE SKIP LOCKED and get locked row/avoid updating other row(s)
Re: FOR UPDATE SKIP LOCKED and get locked row/avoid updating other row(s)
Список pgsql-general
Hi!
I am implementing a queue using PostgreSQL.
I am of course using "FOR UPDATE SKIP LOCKED".

Is there any way I can tell PostgreSQL to only "operate" on the locked row, and/or a way to reference it?

Some explanations of what I mean:
  • I have a table with N rows
  • I lock row X with a PG Function, in transaction 1
  • I do something in my code, using transaction 2
  • I update the status of row X with a PG Function, in transaction 1
In last step, I update the row X status, passing my function the ID of this row X.
But, nothing stops me from updating row Y in the queue table, for whatever reason.

My question again: any way to force a "Just update the row X you locked before, and nothing else/more?"

Thanks!

В списке pgsql-general по дате отправления:

Предыдущее
От: Daniel Gustafsson
Дата:
Сообщение: Re: MAT. VIEW security problems and PG 10-11 versions?
Следующее
От: Adrian Garcia Badaracco
Дата:
Сообщение: Re: Compressing large column by moving it to a unique table