Best way out of that is to temporarily set pg_hba.conf to usenon-password authentication ('trust' or maybe 'ident'). Thenyou can connect without the password, update the password fieldin pg_shadow, and finally restore pg_hba.conf.
regards, tom lane