I've a fresh install of Postgresql 14. I can get in with no problems on the local machine in the terminal, and remotely with pgAdmin 4.
However, I have a Python script that passes a connection string to psycopg2 and sqlalchemy. Using exactly the same credentials and config, authentication fails.
This Python script works perfectly fine when pointed at a managed Postgres instance.
The Python outputs: sqlalchemy.exc.OperationalError: (psycopg2.OperationalError)
From the Postgres logs: FATAL: 28P01: password authentication failed for user "user"
The Postgres user's password is stored in scram-sha-256. Any pointers welcome!
Thank you very much to jjanes above, it was just a problem with special characters! I had an unhandled %
.