Skip to content

fix(db): force max_connections=1 for in-memory SQLite pools#2491

Merged
bug-ops merged 1 commit intomainfrom
2468-migration-056-test-db
Mar 30, 2026
Merged

fix(db): force max_connections=1 for in-memory SQLite pools#2491
bug-ops merged 1 commit intomainfrom
2468-migration-056-test-db

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 30, 2026

Summary

  • In-memory SQLite DBs are connection-scoped: each new pool connection is a separate empty database
  • When pool_size > 1, queries routed to non-migration connections hit a schema-less DB and fail with no such column: superseded_by
  • Fix: cap max_connections = 1 for :memory: URLs in DbConfig::connect_sqlite

Root cause

sqlite::memory: in sqlx creates a distinct in-memory database per physical connection. The pool had min_connections = 1 and max_connections = 5. Migrations ran on the first connection; subsequent connections opened fresh, schema-less DBs. After migration 056 (superseded_by column on graph_edges), all graph tests that used SqliteStore::new(":memory:") began failing with code: 1, message: "no such column: superseded_by".

Test results

Before: 7326 pass / 91 fail
After: 7445 pass / 0 fail

Closes #2468

Each physical connection to sqlite::memory: is a separate empty database.
When the pool size is >1, queries routed to connections other than the one
that ran migrations hit a schema-less DB and fail with
"no such column: superseded_by".

Capping max_connections at 1 for :memory: URLs ensures all queries share
the same migrated schema. Fixes 91 failing graph tests introduced after
migration 056 (superseded_by column) in PR #2465.

Closes #2468
@github-actions github-actions bot added documentation Improvements or additions to documentation rust Rust code changes bug Something isn't working size/XS Extra small PR (1-10 lines) labels Mar 30, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 30, 2026 22:43
@bug-ops bug-ops merged commit edf5b80 into main Mar 30, 2026
27 checks passed
@bug-ops bug-ops deleted the 2468-migration-056-test-db branch March 30, 2026 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation rust Rust code changes size/XS Extra small PR (1-10 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(memory): graph store tests fail after PR #2465 — migration 056 not applied in test DB

1 participant