The documentation says:
The locking clauses cannot be used in contexts where returned rows cannot be clearly identified with individual table rows; for example they cannot be used with aggregation.
How do I work around this in the setting of a recursive query, that is implemented with UNION (ALL)
?
Is there a better solution than joining the result of the recursive query with the table again, this time with FOR UPDATE
? I would have to lock the whole table for this query to make sure that nothing changes concurrently to the join, right?