I created a role with login permission, but I can't login with it, I get:
FATAL: password authentication failed for user "myuser"
I have confirmed by select * from pg_roles that the role exists and has login permission.
I suspect an error in my db set up script caused it to be created with a different password to what I believed it was set to.
I realise that you cannot lookup the existing password of a role but I figure there ought to be a function which can be used to tell if a plaintext matches password for a role?
eg in a web app when we store passwords in the db they are salted and hashed... you can't tell what is the password from looking at that, but you can take a new plaintext and run the password hashing on it and say if the hash of your plaintext matches the stored password.
Is there something like that for psql?
I found other SO questions, eg Authenticate PostgreSQL user and password without database, about how to check password but they suggest trying to login with that role from commandline, which I can't do ("password authentication failed").
In my case I realise I should just trust the error message and assume role was created with wrong password... but let's imagine I'd created a role without LOGIN permission - this way of checking wouldn't be possible.
There are other ways to debug my script of course, but I am curious if such a 'password check' function exists.
For example, I found these in the docs:
http://www.postgresql.org/docs/8.3/static/pgcrypto.html
...but they are provided as helpers for building applications on top of Postgres - it is not clear if they are used by Postgres iteself for role passwords.
hostin yourpg_hba.confare letting you login viapeer(Unix user credentials) instead of viamd5(The actual database credentials). Do you have any means to access thepg_hba.conffile?md5hashing function of thepg_cryptopackage.SELECT rolpassword FROM pg_authid WHERE rolname='myrole';. From the docs.