question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PGPASS should be checked after all other methods

See original GitHub issue

Basically I think the precedence should look like this, but we should probably see what the libpq behavior is (where relevant):

  1. Password in connection string
  2. Passfile in connection string
  3. Password callback (not so sure between this and 2 above)
  4. Password in environment variable
  5. Passfile in environment variable
  6. Default passfile

_Originally posted by @roji in https://github.com/npgsql/npgsql/pull/2657#discussion_r335412006_


The libpg compatible way of getting the password:

  1. Password in connection string
  2. Password callback
  3. Password in environment variable
  4. Passfile in connection string
  5. Passfile in environment variable
  6. Default passfile

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
rojicommented, Oct 29, 2019

I think that the connection string should in general take precedence over programmatic means - this allows users to use the same program/code and select behavior as they want without recompiling or programmatic switching logic.

1reaction
YohDeadfallcommented, Sep 18, 2020

#2500 was made because:

  1. Npgsql Connection pools are based on the connection string, a new password will create a new pool
  2. Npgsql connection pools are never removed once created (but a pool may have zero connections). But if configured to have minimum of 1 problems could arise

It adds some logic into the driver which actually can be done outside of it by excluding the password from the pool key (and maybe other options too).

Read more comments on GitHub >

github_iconTop Results From Across the Web

postgresql: .pgpass not working
pgpass in a user's home directory or the file referenced by PGPASSFILE can contain passwords to be used if the connection requires a...
Read more >
ubuntu - .pgpass with postgreSQL not working
pgpass file must exist in the home directory of the user "using" it and must be readable only by that user. If these...
Read more >
set the pgpass, still ask me password
when I type psql, it still promopt me to password. I thought all things are properly set. later I deleted the second password...
Read more >
PostgreSQL: Documentation: 15: 34.16. The Password File
The file .pgpass in a user's home directory can contain passwords to be used if the connection requires a password (and no password...
Read more >
Documentation: 15: pg_amcheck
pg_amcheck supports running amcheck's corruption checking functions against one or more databases, with options to select which schemas, tables and indexes to ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found