sql - How to lock rows for update but return a smaller result? -
according https://www.postgresql.org/docs/9.5/static/sql-select.html
when locking clause appears in sub-select, rows locked returned outer query sub-query. might involve fewer rows inspection of sub-query alone suggest, since conditions outer query might used optimize execution of sub-query. example,
select * (select * mytable update) ss col1 = 5; lock rows having col1 = 5, though condition not textually within sub-query.
how should write statement such rows sub query locked , not row having col1 = 5 locked?
Comments
Post a Comment