fix(databases): surface the id change when load recreates a managed database#173
Merged
Merged
Conversation
… database Loading an undeclared table into a managed database triggers an auto-declare path that delete+recreates the database (managed DBs have no add-table endpoint), which mints a NEW database id. This was silent unless existing tables had synced data — so the id printed by `databases create` would go stale after the next `load`, and `databases delete <create-id>` failed with "no database with id". Emit a clear note on the recreate (old id -> new id) and point users to reference managed databases by catalog (stable) rather than the create-time id. Document the same in the managed-database workflow. `databases create` itself is correct — the printed id matches `databases list` immediately; only `load`'s recreate changed it.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Loading an undeclared table into a managed database triggers an auto-declare path that delete + recreates the database (managed DBs have no add-table endpoint) — which mints a new database id. This was silent unless existing tables had synced data, so:
databases creategoes stale after the nextloadof a new table, anddatabases delete <create-time-id>then fails with "no database with id".I hit this directly while testing:
databases create --catalog Xprinted one id, but afterdatabases loadthe database was listed under a different id, and delete-by-printed-id failed.Root cause
databases createis correct — its returned id matchesdatabases listimmediately (verified). The id only changes insidetables_load's recreate path (src/databases.rs), and that change was never surfaced when there was no synced data to warn about.Fix
loadrecreates the database, showingid <old> → <new>and pointing users to reference managed databases by catalog (stable), not the create-time id.references/WORKFLOWS.md): auto-declaring a new table recreates the DB and changes its id; reference by catalog, or declare tables up front withdatabases create --table ….No server change needed; this is a transparency fix for an inherent consequence of the recreate workaround.
Verification (production)
cargo build/clippy/fmtclean;databasestest suite green (23 passed).