Before Submitting
db-studio Version
1.13.0
Product Surface
Web App
Database Type
PostgreSQL
Other Database Type
No response
What happened?
With a single-database connection string in .env:
DATABASE_URL=postgresql://marwanhassan@localhost:5432/db_studio_test
the database selector in the bottom-left sidebar lists 2 databases: db_studio_test and postgres — even though only db_studio_test was ever created/connected. The footer also reports Databases: 2.
postgres is PostgreSQL's auto-created maintenance database (initdb creates it on every cluster). It is real, but showing it next to the application database is confusing — it looks like a second running database the user does not recognize.
Root cause: GET /databases → PgAdapter.getDatabasesList() (packages/server/src/adapters/pg/pg.adapter.ts) enumerates the whole server:
SELECT d.datname AS name, ...
FROM pg_catalog.pg_database d
WHERE d.datistemplate = false
ORDER BY d.datname;
postgres has datistemplate = false just like any user DB, so it is always returned. Same class of issue in the other adapters (only MSSQL filtered system DBs): MySQL leaks information_schema/mysql/performance_schema/sys, MongoDB leaks admin/config/local, SQLite lists internal temp.
Steps to Reproduce
- Set
DATABASE_URL=postgresql://<user>@localhost:5432/db_studio_test in .env
- Run
bun run dev and open the web app
- Look at the bottom-left Database selector → shows
db_studio_test and postgres; footer shows Databases: 2
- Confirm server-side:
SELECT datname FROM pg_database WHERE datistemplate = false; returns both rows
Expected Behavior
The selector lists only user-created databases (db_studio_test, count 1). System/maintenance databases stay hidden unless the connection string points at one of them (e.g. DATABASE_URL=.../postgres should still list postgres).
I have this fix implemented and verified locally across all five adapters (filter system DBs, always keep the currently-connected DB visible) and can open a PR if the maintainers agree with the approach.
Screenshots
Screenshot 1 — web app showing two databases (the bug)
The bottom-left Database selector lists two databases even though only one is configured:
db_studio_test (selected)
postgres ← unexpected maintenance database
The footer also reports Databases: 2.
Screenshot 2 — .env with a single database (expected setup)
Only one database is connected to db-studio:
DATABASE_URL=postgresql://marwanhassan@localhost:5432/db_studio_test
Logs / Error Output
No errors — the endpoint behaves as coded; this is a UX/correctness issue, not a crash.
datname
------------------
db_studio_test
postgres
Environment
OS: macOS
Browser: Chrome
Bun version: 1.4.0
Before Submitting
db-studio Version
1.13.0
Product Surface
Web App
Database Type
PostgreSQL
Other Database Type
No response
What happened?
With a single-database connection string in
.env:the database selector in the bottom-left sidebar lists 2 databases:
db_studio_testandpostgres— even though onlydb_studio_testwas ever created/connected. The footer also reportsDatabases: 2.postgresis PostgreSQL's auto-created maintenance database (initdbcreates it on every cluster). It is real, but showing it next to the application database is confusing — it looks like a second running database the user does not recognize.Root cause:
GET /databases→PgAdapter.getDatabasesList()(packages/server/src/adapters/pg/pg.adapter.ts) enumerates the whole server:postgreshasdatistemplate = falsejust like any user DB, so it is always returned. Same class of issue in the other adapters (only MSSQL filtered system DBs): MySQL leaksinformation_schema/mysql/performance_schema/sys, MongoDB leaksadmin/config/local, SQLite lists internaltemp.Steps to Reproduce
DATABASE_URL=postgresql://<user>@localhost:5432/db_studio_testin.envbun run devand open the web appdb_studio_testandpostgres; footer showsDatabases: 2SELECT datname FROM pg_database WHERE datistemplate = false;returns both rowsExpected Behavior
The selector lists only user-created databases (
db_studio_test, count1). System/maintenance databases stay hidden unless the connection string points at one of them (e.g.DATABASE_URL=.../postgresshould still listpostgres).I have this fix implemented and verified locally across all five adapters (filter system DBs, always keep the currently-connected DB visible) and can open a PR if the maintainers agree with the approach.
Screenshots
Screenshot 1 — web app showing two databases (the bug)
The bottom-left Database selector lists two databases even though only one is configured:
db_studio_test(selected)postgres← unexpected maintenance databaseThe footer also reports Databases: 2.
Screenshot 2 —
.envwith a single database (expected setup)Only one database is connected to db-studio:
Logs / Error Output
No errors — the endpoint behaves as coded; this is a UX/correctness issue, not a crash. datname ------------------ db_studio_test postgresEnvironment
OS: macOS
Browser: Chrome
Bun version: 1.4.0