Skip to content

Improve acceptance of a DSN as a positional argument - #2070

Merged
rolandwalker merged 1 commit into
mainfrom
RW/improve-dsn-as-positional-argument
Jul 31, 2026
Merged

Improve acceptance of a DSN as a positional argument#2070
rolandwalker merged 1 commit into
mainfrom
RW/improve-dsn-as-positional-argument

Conversation

@rolandwalker

Copy link
Copy Markdown
Contributor

Description

  • Don't let a --password argument indicate that an ambiguous DSN alias is a database name. We generally expect passwords to be given separately from a DSN.
  • Do let an explicit --socket argument suggest that an ambiguous argument is a database name rather than a DSN alias.
  • Emit a warning on taking an ambiguous argument to be a database name, when it also exists as a DSN alias.
  • Complete DSN aliases as positional arguments outside of the first position in zsh.
  • Accept DSN aliases as zsh completions after --database or -D. This is weird, but we do accept DSNs there, so we might as well offer the completions.

There is some effect on non-positional DSN values, but the changes mostly concern positional arguments.

Checklist

  • I added this contribution to the changelog.md file.
  • I added my name to the AUTHORS file (or it's already there).
  • To lint and format the code, I ran
    uv run ruff check && uv run ruff format && uv run mypy --install-types .

@rolandwalker rolandwalker self-assigned this Jul 31, 2026
@rolandwalker
rolandwalker force-pushed the RW/improve-dsn-as-positional-argument branch from 12b84a1 to 801fce2 Compare July 31, 2026 12:07
 * don't let a --password argument indicate that an ambiguous DSN alias
   is a database name.  We generally expect passwords to be given
   separately from a DSN.
 * do let an explicit --socket argument suggest that an ambiguous
   argument is a database name rather than a DSN alias.
 * emit a warning on taking an ambiguous argument to be a database name,
   when it also exists as a DSN alias.
 * complete DSN aliases as positional arguments outside of the first
   position in zsh.
 * accept DSN aliases as zsh completions after --database or -D.  This
   is weird, but we do accept DSNs there, so we might as well offer the
   completions.

There is some effect on non-positional DSN values, but the changes
mostly concern positional arguments.
@rolandwalker
rolandwalker force-pushed the RW/improve-dsn-as-positional-argument branch from 801fce2 to 3ab370d Compare July 31, 2026 12:11
@rolandwalker
rolandwalker merged commit 9da3195 into main Jul 31, 2026
11 checks passed
@rolandwalker
rolandwalker deleted the RW/improve-dsn-as-positional-argument branch July 31, 2026 12: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