Commit ee0db94
fix(sqlite): preserve SQLite URI params through finalizer (#18)
* fix(sqlite): preserve SQLite URI params through finalizer
The `finalizerSQLite` stripped any DSN query param not in `moderncSQLiteParams`,
with a comment claiming that set was the "complete" list of params recognised
by modernc.org/sqlite. That's true for Go-driver params (_pragma etc.), but
the list also needed SQLite's own URI params — `mode`, `cache`, `psow`,
`nolock`, `immutable` — which SQLite parses itself when SQLITE_OPEN_URI is
set (modernc enables it unconditionally in conn.go).
Without this, a DSN like `file:name?mode=memory&cache=shared` had `mode` and
`cache` dropped before reaching modernc, causing sqlite3_open_v2 to fall back
to creating an on-disk file named `name` instead of an in-memory database.
Downstream impact: Hydra and other services that use `DSN=memory` to
construct `file:<random>?mode=memory&cache=shared` ended up with stray SQLite
files accumulating in the working directory after each process start.
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 0277b33 commit ee0db94
2 files changed
Lines changed: 69 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
368 | 368 | | |
369 | 369 | | |
370 | 370 | | |
371 | | - | |
372 | | - | |
373 | | - | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
374 | 383 | | |
375 | 384 | | |
376 | 385 | | |
| |||
379 | 388 | | |
380 | 389 | | |
381 | 390 | | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
382 | 396 | | |
383 | 397 | | |
384 | 398 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
546 | 547 | | |
547 | 548 | | |
548 | 549 | | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
549 | 601 | | |
550 | 602 | | |
551 | 603 | | |
| |||
0 commit comments