Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres Size Metric requires CONNECT permissions to all Databases #116

Open
Setheck opened this issue Jan 22, 2025 · 0 comments
Open

Postgres Size Metric requires CONNECT permissions to all Databases #116

Setheck opened this issue Jan 22, 2025 · 0 comments
Assignees

Comments

@Setheck
Copy link

Setheck commented Jan 22, 2025

Description

The Postgres size metric seems to run the following query
"SELECT pg_database.datname, pg_database_size(pg_database.datname) as size_bytes FROM pg_database" seen (

rows, err := p.DB.Raw("SELECT pg_database.datname, pg_database_size(pg_database.datname) as size_bytes FROM pg_database").Rows()
)

This query fails with the following on AWS RDS
ERROR: permission denied for database rdsadmin

This is because it would require CONNECT permissions to all database to get the size with pg_database_size

When metrics are collected they should only reference the current database.

Is there any reason not to change this to be something like
SELECT current_database() as datname, pg_database_size(current_database()) size_bytes;
?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants