Before submitting
This repo is for Npgsql ADO.NET issues only. Entity Framework issues belong in Npgsql.EntityFrameworkCore.PostgreSQL for EF Core, or EntityFramework6.Npgsql for EF 6.x.
Steps to reproduce
- Read the documentation:
The file .pgpass in a user's home directory can contain passwords to be used if the connection requires a password (and no password has been specified otherwise)
- Create a valid
~/.pgpass
- Run this code:
using Npgsql;
await using var connection = new NpgsqlConnection("Host=myhost;Username=myuser;Database=mydb;");
await connection.OpenAsync();
- Observe the error below.
- Copy
~/.pgpass to ~/postgresql/.pgpass
- Run the code above, this time without an error.
I don't think we should do this:
|
Path.Combine(appData, "postgresql", fileName) is string filePath && |
on unix environment for .pgpass
The issue
Describe what is not working as expected.
If you are seeing an exception, include the full exceptions details (message and stack trace).
Unhandled exception. Npgsql.NpgsqlException (0x80004005): No password has been provided but the backend requires one (in MD5)
at Npgsql.NpgsqlConnector.AuthenticateMD5(String username, Byte[] salt, Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlConnector.Authenticate(String username, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
at Npgsql.ConnectorPool.OpenNewConnector(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
at Npgsql.ConnectorPool.<>c__DisplayClass38_0.<<Rent>g__RentAsync|0>d.MoveNext()
--- End of stack trace from previous location ---
at Npgsql.NpgsqlConnection.<>c__DisplayClass41_0.<<Open>g__OpenAsync|0>d.MoveNext()
--- End of stack trace from previous location ---
at <Program>$.<<Main>$>d__0.MoveNext() in /workspaces/client/example1/example1.cs:line 5
--- End of stack trace from previous location ---
at <Program>$.<<Main>$>d__0.MoveNext() in /workspaces/client/example1/example1.cs:line 13
--- End of stack trace from previous location ---
at <Program>$.<Main>(String[] args)
Further technical details
Npgsql version: 5.0.4
PostgreSQL version: 13.2
Operating system: Ubuntu 20.04.2 LTS
Other details about my project setup:
Before submitting
This repo is for Npgsql ADO.NET issues only. Entity Framework issues belong in Npgsql.EntityFrameworkCore.PostgreSQL for EF Core, or EntityFramework6.Npgsql for EF 6.x.
Steps to reproduce
~/.pgpass~/.pgpassto~/postgresql/.pgpassI don't think we should do this:
npgsql/src/Npgsql/PostgresEnvironment.cs
Line 38 in d34f2ce
on unix environment for
.pgpassThe issue
Describe what is not working as expected.
If you are seeing an exception, include the full exceptions details (message and stack trace).
Further technical details
Npgsql version: 5.0.4
PostgreSQL version: 13.2
Operating system: Ubuntu 20.04.2 LTS
Other details about my project setup: