But the XA spec (http://pubs.opengroup.org/onlinepubs/009680699/toc.pdf) says for XAER_RMERR that "An error occurred in committing the work performed on behalf of the transaction branch and the branch’s work has been rolled back. Note that returning this error signals a catastrophic event to a transaction manager since other resource managers may successfully commit their work on behalf of this branch. This error should be returned only when a resource manager concludes that it can never commit the branch and that it cannot hold the branch’s resources in a prepared state. Otherwise, [XA_RETRY] should be returned."
From what is said here I think that PostgreSQL database should rollback the transaction itself and then it could return XAException error code XAER_RMERR or it should return XAER_RMFAIL or XAER_RETRY.
Would you mind my opening a issue for PostgreSQL jdbc driver?