Repository navigation
fix(databases): load by id, scope query status, name fork ambiguity #341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,11 +48,13 @@ pub fn try_resolve_connection_id(api: &Api, name_or_id: &str) -> Result<String, | |
| } | ||
|
|
||
| // Fall back to instant databases: treat name_or_id as a catalog alias. | ||
| if let Ok(db) = crate::commands::databases::try_resolve_database(api, name_or_id) { | ||
| return Ok(db.default_connection_id); | ||
| // An ambiguous alias (a fork shares its source's catalog) is reported as | ||
| // such, not as "no catalog": the caller's fix is to pass the id. | ||
| match crate::commands::databases::try_resolve_database(api, name_or_id) { | ||
| Ok(db) => Ok(db.default_connection_id), | ||
| Err(e) if e.contains("multiple databases") => Err(e), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Add a unit test for this ambiguous-alias branch (not blocking). The branch depends on a substring of the message at |
||
| Err(_) => Err(format!("no catalog with id '{name_or_id}'")), | ||
| } | ||
|
|
||
| Err(format!("no catalog with id '{name_or_id}'")) | ||
| } | ||
|
|
||
| /// Resolve a connection name or ID to a connection ID, exiting on failure. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Drop the "-d before
status" instruction (not blocking).-dis nowglobal = trueinsrc/cli.rs:56, soquery status <id> -d <db>also parses. The PR description cites that exact form as the fix. Agents that read this line apply an ordering rule that does not exist.