diff --git a/README.md b/README.md
index d9866f22..45a9ab3e 100644
--- a/README.md
+++ b/README.md
@@ -161,6 +161,11 @@ or a variant of postgres (e.g. Greenplum) you can disable the default metrics wi
 flag. This removes all built-in metrics, and uses only metrics defined by queries in the `queries.yaml` file you supply
 (so you must supply one, otherwise the exporter will return nothing but internal statuses and not your database).
 
+### Automatically discover databases
+To scrape metrics from all databases on a database server, the database DSN's can be dynamically discovered via the 
+`--auto-discover-databases` flag. When true, `SELECT datname FROM pg_database` is run for all configured DSN's. From the 
+result a new set of DSN's is created for which the metrics are scraped.
+
 ### Running as non-superuser
 
 To be able to collect metrics from `pg_stat_activity` and `pg_stat_replication`
diff --git a/cmd/postgres_exporter/postgres_exporter.go b/cmd/postgres_exporter/postgres_exporter.go
index fa4c2996..1968b006 100644
--- a/cmd/postgres_exporter/postgres_exporter.go
+++ b/cmd/postgres_exporter/postgres_exporter.go
@@ -1064,7 +1064,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") // nolint: safesql
 	if err != nil {
 		return nil, fmt.Errorf("Error retrieving databases: %v", err)
 	}