I have been working extensively with peewee and postgresql for months.  Suddenly this started happening.  If I run any query command and get an error, then all subsequent commands start returning peewee.InternalError: current transaction is aborted, commands ignored until end of transaction block .
I thought this behavior started when I upgraded peewee from 3.5.2 to 3.7.2, but I have since downgraded and the behavior continues.  This has definitely not always happened.
In the simplest case, I have a database table with exactly one record.  I try to create a new record with the same id and I get an IntegrityError as expected.  If I then try to run any other query commands on that database, I get the InternalError as above.
This does not happen with an sqlite database.
I have reinstalled peewee and psycopg2, to no avail.
What am I missing?
While it's fine to use autorollback, it's much better to explicitly manage your transactions so that where an integrity error might occur you are catching the error and explicitly rolling back. For instance, if you have a user signup page and there's a unique constraint on the username, you might wrap it in a try/except and rollback upon failure.
Why am I getting peewee.InternalError for all subsequent commands after one failed command, using peewee ORM with posgresql?