Skip to content

fix(utilities): pgstatindex for Postgres fragmentation, MariaDB its own family, and SQLite credentials selectable again - #274

Merged
huyplb merged 2 commits into
mainfrom
fix/utilities-postgres-mariadb-and-sqlite-picker
Aug 19, 2026
Merged

fix(utilities): pgstatindex for Postgres fragmentation, MariaDB its own family, and SQLite credentials selectable again#274
huyplb merged 2 commits into
mainfrom
fix/utilities-postgres-mariadb-and-sqlite-picker

Conversation

@huyplb

@huyplb huyplb commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Three fixes that missed the #273 squash — it was taken from the branch before these landed, so main does not have them. Caught while verifying main ahead of a release tag: the unit count on main was 1955 against 1961 on the branch.

Two of these are bugs reported from the running app, and one is a regression from #271.

Index fragmentation on PostgreSQL could never have worked

The probe read SELECT leaf_fragmentation FROM pgstattuple(ci.oid). Against PostgreSQL 17:

-- extension absent (the default, and the reported error)
ERROR:  function pgstattuple(oid) does not exist
-- extension installed — the obvious next thing to try
ERROR:  column "leaf_fragmentation" does not exist

pgstattuple reports table statistics. leaf_fragmentation belongs to pgstatindex, which returns 0 on a real index. Installing the extension only swapped one error for another.

Now uses pgstatindex(ci.oid::regclass), verified returning values. Two follow-ons: pgstatindex yields NaN for an index with no leaf pages yet — nulled out, since NaN% in a column reads as a bug — and a missing extension now explains itself (CREATE EXTENSION pgstattuple;, superuser needed) instead of relaying the driver's sentence.

MariaDB was aliased to MySQL, and two probes are wrong on it

Against MariaDB 11.8:

SELECT @@innodb_buffer_pool_instances;                      -- ERROR 1193: Unknown system variable
SELECT ... FROM performance_schema.global_status ...;        -- (empty)
SELECT ... FROM information_schema.GLOBAL_STATUS ...;        -- 245412

The removed variable killed System info outright — the reported bug. The empty one was quieter and worse: performance_schema is off by default on MariaDB, so the pool panel showed blank connection counts with no error at all.

MariaDB is now its own family, reading status from information_schema and dropping the variable it no longer has. Sessions and sizes share the MySQL queries, which do work on it.

Verified live, all four utilities: pool 151 max / 1 connected / 18 cached, sessions listed, system up 245536s on 11.8.8-MariaDB, sizes per table.

Selecting a saved SQLite connection asked for a password it cannot have

Regression from #271. selectSavedConnection treats "no stored password" as "prompt the user" — never reached for SQLite while the credential form still offered a Save-password box. #271 hid that box for file dialects, correctly, so SQLite credentials now save with hasPassword: false. Picking one as Source or Target opened a password prompt, snapped the picker back to "— Saved —", and left nothing selected; Snapshot, Compare and Migrate all sat disabled with nothing explaining why.

Reproduced by hand in the browser before trusting the test. isFileDialect / dialectUsesPassword now live in provider-settings beside the rest of the per-dialect truth, so the picker and the connection modal read one definition.

Reviewer note

main currently ships all three bugs. I'd merge this before tagging a release — that is what stopped me tagging v0.2.110.

Gates

tsc --noEmit clean · vitest run 1961 pass / 2 expected-fail · eslint 0 errors. E2E on the source branch: schema-revert 4/4, revert-edges 10/10, schema-history 6/6.

🤖 Generated with Claude Code


Note

Medium Risk
Changes touch live connection selection, PostgreSQL fragmentation SQL, and MariaDB utility probes against real databases; scope is bounded and covered by unit tests.

Overview
Fixes three production bugs: PostgreSQL index fragmentation that could never succeed, MariaDB DBA utilities aliased to MySQL, and saved SQLite/DuckDB connections blocked by a password prompt.

PostgreSQL index fragmentation now calls pgstatindex (from pgstattuple) instead of pgstattuple for leaf_fragmentation, with NULLIF so unmeasured indexes do not show NaN%. API failures from a missing extension are rewritten to mention CREATE EXTENSION pgstattuple;.

MariaDB is no longer folded into the MySQL family for DBA pool/system probes: status reads information_schema.GLOBAL_STATUS instead of performance_schema, and system info drops @@innodb_buffer_pool_instances. Sessions and sizes still share MySQL SQL where it works.

File dialect credentials get shared isFileDialect / dialectUsesPassword helpers so picking a saved SQLite connection without a stored password no longer opens the session password modal and resets the dropdown.

E2E history test expectations are tightened so default type filters are not asserted for object types absent from the seed schema.

Reviewed by Cursor Bugbot for commit 4c2bf25. Bugbot is set up for automated code reviews on this repo. Configure here.

huyplb and others added 2 commits August 18, 2026 18:14
…t cannot have

A real break, found by running the revert e2e before releasing rather than
after. `selectSavedConnection` treats "no stored password" as "prompt the user",
which was never reached for SQLite while the credential form still offered a
Save-password box. #271 hid that box for file dialects — correctly, a file has no
password — so SQLite credentials now save with `hasPassword: false`, and picking
one as Source or Target opened a password prompt, snapped the picker back to
"— Saved —", and left no connection selected. Snapshot, Compare and Migrate all
stayed disabled with nothing on screen explaining why.

Reproduced by hand in the browser, not inferred from the test: pick a saved
SQLite credential, watch the select revert.

`isFileDialect` / `dialectUsesPassword` now live in `provider-settings` beside
the rest of the per-dialect truth, and both the picker and the connection modal
read them instead of each carrying their own copy of the list.

Also updates the last e2e that asserted the old filter behaviour: it checked
`isChecked()` on Function and Procedure boxes, which this seed's schema does not
have and which are therefore no longer rendered — an assertion on an absent
control hangs rather than fails.

E2E after this, against the running app: schema-revert 4/4,
schema-version-revert-edges 10/10, schema-history 6/6.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…, and MariaDB is not MySQL

Two reported failures, both reproduced against the live engines rather than
reasoned about.

**Index fragmentation on PostgreSQL could never have worked.** The probe read
`SELECT leaf_fragmentation FROM pgstattuple(ci.oid)`. Against PostgreSQL 17:

    -- extension absent (the default, and the reported error)
    ERROR:  function pgstattuple(oid) does not exist
    -- extension installed — the obvious fix
    ERROR:  column "leaf_fragmentation" does not exist

`pgstattuple` reports *table* statistics. `leaf_fragmentation` belongs to
`pgstatindex`, which returns 0 for a real index. So installing the extension
swapped one error for another; the feature was broken either way. Now uses
`pgstatindex(ci.oid::regclass)`, verified returning values on that server.

Two follow-ons. `pgstatindex` yields NaN for an index with no leaf pages yet —
"nothing measured", not a number, and `NaN%` in a column reads as a bug — so it
is nulled out. And a missing extension now explains itself: the panel says the
server needs `CREATE EXTENSION pgstattuple;` and that a superuser can add it,
instead of relaying the driver's sentence.

**MariaDB was aliased to the MySQL family and two probes were wrong on it.**
Against MariaDB 11.8:

    SELECT @@innodb_buffer_pool_instances;   -- ERROR 1193: Unknown system variable
    SELECT ... FROM performance_schema.global_status ...   -- (empty)
    SELECT ... FROM information_schema.GLOBAL_STATUS ...   -- 245412

The removed variable killed System info outright, which is the reported bug. The
empty one was quieter and worse: performance_schema is off by default on
MariaDB, so the pool panel showed blank connection counts with no error at all.
MariaDB is now its own family, reading status from `information_schema` and
dropping the variable it no longer has; sessions and sizes share the MySQL
queries, which do work on it.

Verified live, all four utilities: pool 151 max / 1 connected, sessions listed,
system up 245536s on 11.8.8-MariaDB, sizes reported per table.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@cursor

cursor Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_66cb2f09-3dcb-4b18-ad70-4ee2ac909036)

@huyplb
huyplb merged commit bfc2a95 into main Aug 19, 2026
11 checks passed
@huyplb
huyplb deleted the fix/utilities-postgres-mariadb-and-sqlite-picker branch August 19, 2026 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant