prometheus-community / prometheus-community/postgres_exporter

Error opening connection to database / database \"postgres_exporter\" does not exist

Open Beginner friendly
#1,365 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
3.6k
Forks
835
Avg merge
2d 4h
Merged PRs (30d)
10

Description

What did you do?

What did you expect to see?

It would have been great if the README https://github.com/prometheus-community/postgres_exporter#running-as-non-superuser had included the following SQL query.

 CREATE DATABASE postgres_exporter;

That solved the issue.

What did you see instead? Under which circumstances?

The monitoring system and metrics reported downtime for the PostgreSQL server.

Environment

  • System information:

    Linux 6.12.94+deb13-amd64 x86_64

  • postgres_exporter version:

    0.20.1

  • postgres_exporter flags:

    • database
    • replication_slot
    • stat_bgwriter
  • PostgreSQL version:

    17

  • Logs:

journalctl -u postgres_exporter.service -e

relevant output:

Aug 12 06:54:17 social postgres_exporter[686468]: time=2026-08-12T06:54:17.300Z level=ERROR source=collector.go:191 msg="Error opening connection to database" err="error querying postgresql version: pq: database \"postgres_exporter\" does not exist"
Aug 12 06:54:18 social postgres_exporter[686468]: time=2026-08-12T06:54:18.300Z level=ERROR source=postgres_exporter.go:606 msg="error scraping dsn" err="Error opening connection to database (postgresql://postgres_exporter:PASSWORD_REMOVED@localhost:5432/?sslmode=disable): pq: database \"postgres_exporter\" does not exist" dsn="postgresql://postgres_exporter:PASSWORD_REMOVED@localhost:5432/?sslmode=disable"

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open the README section on running as a non-superuser and compare its setup steps with the reported failure. Document the CREATE DATABASE postgres_exporter statement, then verify the rendered README clearly explains that the database must exist before starting postgres_exporter.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql
Domain
databases, documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.