Chapman Flack <c...@anastigmatix.net> writes: > Given a Portal, or an _SPI_plan, is there a practical way to tell whether > it came from a query with FOR UPDATE or FOR SHARE?
In principle, you could do something like drilling down into the plan tree to see if there's a LockRows node, but this wouldn't necessarily be a great idea from a modularity or maintainability standpoint. I think it would help to take two steps back and ask why you want to know this, and what exactly is it that you want to know, anyhow. What does it matter if there's FOR SHARE in the query? Does it matter if the FOR SHARE targets only some tables (and do you care which ones?) How would your answer change if the FOR SHARE were buried down in a CTE subquery? Why are you only interested in these cases, and not INSERT/UPDATE/DELETE? regards, tom lane