While implementing Query Tool, I came to know we need error message's with some extra information and also I have faced one issue regarding asynchronous connection polling. I have added support for formatted error message and also fixed the issue.
Attached is the patch file. Please review it and let me know the review comments if any.
Apart from above, today I fixed one more issue. In case of user cancel the running transaction, poll function of psycopg2 returns psycopg2.extensions.POLL_OK, which is mislead by the caller of the function, so I have added one flag which will be true if user purposely cancel the transaction and from our poll function we return new status i.e. ASYNC_CANCEL_TRANSACTION.
Attached is the modified patch. Please review it and if it looks good please commit it.