Skip to content

PostgreSQL connection: Username as fallback for database#3992

Closed
V02460 wants to merge 3 commits intolaunchbadge:mainfrom
V02460:pgoptions-default-db
Closed

PostgreSQL connection: Username as fallback for database#3992
V02460 wants to merge 3 commits intolaunchbadge:mainfrom
V02460:pgoptions-default-db

Conversation

@V02460
Copy link
Copy Markdown
Contributor

@V02460 V02460 commented Aug 22, 2025

This PR works on the PgConnectOptions to implement the fallback to the username if no database name is given. It notably touches the passfile lookup and connection establishment.

The first commit is a bit broader refactor to use getter methods for fields where appropriate. This better distinguishes raw user-supplied values vs. their derived form.

Is this a breaking change?

Yes. The following changes in observable behavior are intended:

  • Passfile lookup defaulting to the username when not given a database name (breaking, did default to the empty string)
  • Always passing a database name when establishing a connection (breaking, did pass None on missing database)
  • Changed signature of get_database (breaking)
  • New public getter methods get_password and get_extra_float_digits (not breaking)

@V02460 V02460 force-pushed the pgoptions-default-db branch from 43e68a3 to 6f3c014 Compare August 22, 2025 14:47
@abonander
Copy link
Copy Markdown
Collaborator

The fallback to the username is actually done server-side. I don't think this change needs to be made, and it could be surprising to existing users of the API.

If anything, maybe we just need a docs clarification here.

@abonander abonander closed this May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants