create encrypted password for postgresql

If you ever have the need to generate an encrypted password to put it into scripts or anything else, then you can use the following SQL command to generate it:

select 'md5'||md5('password'||'rolename');

or in shell

echo -n 'passwordrolename' | md5sum | awk '{ print "md5" $1 }'

Important is, that your rolename is appended to your password and this construct then put into md5. The important piece in the source is pg_md5_encrypt()