Message-ID: From: "davecramer (@davecramer)" To: "pgjdbc/pgjdbc" Date: Tue, 06 Jan 2026 10:47:35 +0000 Subject: Re: [pgjdbc/pgjdbc] PR #3897: fix: issue #3892, PGXAConnection.prepare(Xid) should return XA_RDONLY if the connection is read only In-Reply-To: References: List-Id: X-GitHub-Author-Login: davecramer X-GitHub-Comment-Id: 3714227622 X-GitHub-Comment-Type: issue_comment X-GitHub-Issue: 3897 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/pull/3897#issuecomment-3714227622 Content-Type: text/plain; charset=utf-8 After doing more reading I'm not even sure we should be returning XA_RDONLY at all, this is the job of the XA manager. XA_RDONLY is returned by prepare when no data has changed, ie the transaction only reads data. As such no commit is necessary. see https://www.ibm.com/docs/en/i/7.6.0?topic=applications-example-using-cli-xa-transaction-connection-attributes or https://docs.oracle.com/javase/8/docs/api/javax/transaction/xa/XAResource.html#XA_RDONLY. If in fact you provide a read only connection and a writer connection and expect data to be written the correct thing to do here is throw an exception as the data was not written and can't possibly be written.