Closed CHERTS closed 1 week ago
Thanks for the PR.
In general, the information about which schema an extension is installed in seems to be useful enough to be included the pgmetrics output.
I'm thinking it might be better to collect the name of the schema also during getExtensions()
, store it in a new field in pgmetrics.Extension
, and use it later in the getStatements*()
functions.
The new query in getExtensions
can be:
SELECT e.name AS name, current_database(),
COALESCE(e.default_version, ''),
x.extversion,
COALESCE(e.comment, ''),
x.extnamespace::regnamespace
FROM pg_available_extensions() e(name, default_version, comment)
LEFT JOIN pg_extension x ON e.name = x.extname
WHERE x.extversion IS NOT NULL
ORDER BY name ASC
What are your thoughts?
Hi
I think this is a good idea, I'll try to improve my PR
@mdevan please, review my changes)
Thanks for the update. Couple more minor changes are required for consistency with how we add new fields and modify queries, but I think I'll do that myself after merging this in.
The database may have a non-standard search_path (standard:
"$user", public
) that does not include the public schema. In this case, you need to discovery which schema the pg_stat_statements extension is installed in and use the full name schema.pg_stat_statements in the query.