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

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -