Looks like this is a problem (bug?) of particular psycopg version 3.2.4. Try to downgrade to 3.2.3. In my case it helped.