Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

  DELETE FROM task_queue
  WHERE id = ( -- Use '=' for a single expected ID
    SELECT id FROM task_queue
    WHERE queue_group_id = 15
    LIMIT 1
    FOR UPDATE SKIP LOCKED
  )
  RETURNING item_id;
I don't understand where that item_id value comes from, since that's not a column that's mentioned anywhere else in the query.

I guess it must be an unmentioned column on that task_queue table?



In DELETE ... RETURNING, RETURNING works like SELECT in a read query, so, yes, item_id is a column in task_queue and the result set is the item_id value of the row deleted.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: