Skip to content

Need NpgsqlConnection.CloneWithAsync(), since CloneWith() always calls the sync password provider lambda #5852

@roji

Description

@roji

NpgsqlConnection.CloneWith() is an API that allows cloning a connection - with all of its current config and authentication information - while changing some connection string details. This is e.g. used by EF to change the database name in the connection string to postgres, so that the user's database can be created.

The problem is that CloneWith() always calls NpgsqlDataSource.GetPassword() synchronously. This is bad because it uses sync I/O even in async scenarios, and also e.g. forces users to provide a sync lambda to UsePasswordProvider(), even if they don't want to do sync I/O (and many auth token providers don't actually support sync I/O).

We can add NpgsqlConnection.CloneWithAsync(), which would call NpgsqlDataSource.GetPassword() asynchronously.

Thanks @eerhardt for raising this.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions