postgresql add tag
The [docs on `pg_stat_activity`][1] tell us that `datname` is the...

> Name of the database this backend is connected to

I can currently see a number of records where `datname` is NULL. How have these mischievous workers connected to my database service without the virtue of a database context?


If I had superuser permissions, I might be able to see that these workers have a `backend_type` something like...

- autovacuum launcher
- logical replication launcher
- background writer
- checkpointer
- walwriter

![Screenshot 2020-07-30 at 15.22.00.png](/image?hash=f72def8e737c87c7249f07ebd51916e883e8dd30a17f8209a6c32ae1fa41b2a6)

From the [source code][2], I can hazard a guess that [`pgstat_fetch_stat_local_beentry`][3] is bailing trying to define the backend context for these workers. But the fact that I'm trying to read C code means I've probably failed at more elementary googling.

Halp me, TA; you're my only hope...


This room is for discussion about this question.

Once logged in you can direct comments to any contributor here.

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.