Skip to content

Postgres Size Metric requires CONNECT permissions to all Databases #116

Open
@Setheck

Description

@Setheck

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;
?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions