Skip to content
This repository was archived by the owner on Apr 11, 2026. It is now read-only.

Clarify MultiHostUrl behavior for Postgres DSN without host - #1903

Closed
gcomneno wants to merge 9 commits into
pydantic:mainfrom
gcomneno:test/multihosturl-optional-host-378
Closed

Clarify MultiHostUrl behavior for Postgres DSN without host#1903
gcomneno wants to merge 9 commits into
pydantic:mainfrom
gcomneno:test/multihosturl-optional-host-378

Conversation

@gcomneno

@gcomneno gcomneno commented Feb 21, 2026

Copy link
Copy Markdown

Summary

This PR updates tests to document the current MultiHostUrl behavior for the Postgres DSN pattern:

postgresql://derp@/databasename?host=/var/run/postgresql

Today this is rejected with url_parsing: empty host.

What’s covered by the added cases

Accepted:

  • postgresql:///databasename
  • postgresql:///databasename?user=derp
  • postgresql://derp@%2Fvar%2Frun%2Fpostgresql/databasename

Rejected:

  • postgresql://derp@/databasename?host=/var/run/postgresqlempty host

Question (maintainer guidance)

Would you prefer MultiHostUrl to remain URL-strict here (i.e. keep rejecting userinfo + empty host), and keep any Postgres-DSN specific flexibility in a dedicated type/variant instead?

CI note

Some checks are currently failing, but this appears unrelated to this test-only change (integration error: SchemaValidator.__new__() got an unexpected keyword argument '_use_prebuilt', suggesting an environment/build mismatch). Happy to rerun/rebase once CI is green.

Refs #378.

No runtime behavior changes.

@codspeed-hq

codspeed-hq Bot commented Feb 21, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 163 untouched benchmarks


Comparing gcomneno:test/multihosturl-optional-host-378 (a10c291) with main (383eb95)

Open in CodSpeed

@codecov

codecov Bot commented Feb 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/validators/mod.rs 0.00% 9 Missing ⚠️
src/serializers/mod.rs 0.00% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

@gcomneno gcomneno closed this by deleting the head repository Feb 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant