I normally retrieve the row_count of a query by doing GET DIAGNOSTICS row_count (normally within a function).
But if I want to run EXPLAIN ANALYZE on a query AND get row_count, I can't see any easy way to do that other than parsing the string output, because then GET DIAGNOSTICS row_count would return the number of rows in the EXPLAIN output.
Is there any built in way to do this other than parsing the string?
SECURITY DEFINERfunctions. Also, applications typically do not want to allow everything that is granted to a role, only a small subset of operations defined by the app. Privileges of a role are typically a superset. – Erwin Brandstetter Oct 13 '15 at 14:11