First thing I'd look at is whether it's the same execution environment
in both cases, eg same search_path.
As far as I can tell, it's the same execution environment, same search_path and same user.
I found after testing other situations, that the psql command would always finish as expected after canceling the first query that ran too long. I was able to reproduce this scenario with psql and pgadmin4 with various combinations.
Any suggestions on what that would indicate? The canceled query does not complete as there are no rows and no duplicate errors when running the second time.
corey