Skip to content

Commit 5004faa

Browse files
committed
improvement: support SKIP LOCKED in locks
1 parent 82dd4d0 commit 5004faa

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/data_layer.ex

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3214,6 +3214,13 @@ defmodule AshPostgres.DataLayer do
32143214
def lock(query, unquote(lock), _) do
32153215
{:ok, Ecto.Query.lock(query, [{^0, a}], fragment(unquote(frag), a))}
32163216
end
3217+
3218+
frag = "#{lock} OF ? SKIP LOCKED"
3219+
lock = "#{lock} SKIP LOCKED"
3220+
3221+
def lock(query, unquote(lock), _) do
3222+
{:ok, Ecto.Query.lock(query, [{^0, a}], fragment(unquote(frag), a))}
3223+
end
32173224
end
32183225

32193226
@impl true

0 commit comments

Comments
 (0)