I was trying to accomplish this on datasets and could not figure out the 
magic. Using Model.with(:enqueued, Model.where(status: 
'ready').returning.update(status: 'processing')) does not work as expected 
in this case.

Here's what I'm trying to replicate:

```with updated_notifications as (
            update notification_events
            set notification_event_status='PROCESSING'
            where id IN (
                select id from notification_events e
                where notification_event_status = 'ENQUEUED'
                order by created_at FOR UPDATE SKIP LOCKED LIMIT 10)
            RETURNING *)
        select * from updated_notifications order by created_at```

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/7899bcee-8394-44e9-8bc6-37b1552031cdn%40googlegroups.com.

Reply via email to