Repository navigation
Fix admin connection when the connection was set via SetDbConnection - #4117
Open
EnesKartal wants to merge 1 commit into
Open
EnesKartal wants to merge 1 commit into
EnesKartal wants to merge 1 commit into
Conversation
…ection Database.SetDbConnection() doesn't update the options, so CreateAdminConnection() rebuilt the admin connection from the (password-redacted) connection string instead of cloning the connection, causing "No password has been provided" with SCRAM auth. Fixes npgsql#3600
This branch has not been deployed
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.
CreateAdminConnection only cloned the connection if it came from the options. With SetDbConnection() it rebuilt it from the connection string, which has no password once the connection was opened (Persist Security Info=false), so Migrate() failed with "No password has been provided".
It now clones the current connection in that case too. Added a regression test in ConnectionSpecificationTest; it fails without the change. Ran ConnectionSpecificationTest and NpgsqlRelationalConnectionTest locally against PostgreSQL 17 with SCRAM. Also confirmed the Migrate() scenario from the issue.
Fixes #3600