Best way out of that is to temporarily set pg_hba.conf to use
non-password authentication ('trust' or maybe 'ident'). Then
you can connect without the password, update the password field
in pg_shadow, and finally restore pg_hba.conf.
regards, tom lane