Discover only databases that are not templates and allow connections (#297)
* Discover only databases that are not templates and allow connections * Update readme
This commit is contained in:
committed by
Will Rouesnel
parent
c768e64548
commit
1ab8d2bbc8
@@ -1074,7 +1074,7 @@ func newDesc(subsystem, name, help string, labels prometheus.Labels) *prometheus
|
||||
}
|
||||
|
||||
func queryDatabases(server *Server) ([]string, error) {
|
||||
rows, err := server.db.Query("SELECT datname FROM pg_database") // nolint: safesql
|
||||
rows, err := server.db.Query("SELECT datname FROM pg_database WHERE datallowconn = true AND datistemplate = false") // nolint: safesql
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Error retrieving databases: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user