From: J Chapman Flack <jflack@math.purdue.edu>
To: pgsql-jdbc@postgresql.org
Subject: get/setReadOnly broken if default_transaction_read_only on
Date: Wed, 06 Jun 2012 16:11:52 -0400
Message-ID: <4FCFB988.2080408@math.purdue.edu> (raw)
Hi,
I've found this in the git head so it applies to current versions.
AbstractJdbc2Connection initializes its readOnly member to a
hardcoded false instead of to 'show default_transaction_read_only'
from the backend.
That means two things: 1. getReadOnly() is wrong in case the
backend has default_transaction_read_only on, and
2. setReadOnly(false) doesn't work in that case, because the value
is compared to readOnly and looks the same, so no set session
characteristics command is sent to the backend.
An application can work around (2) by always calling
setReadOnly(true);setReadOnly(false); if it wants to write.
But that's a bit ugly.
The driver could do that too for a quick hack, but it would
be nice to query the correct value from the backend and use that.
Cheers,
Chapman Flack
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: jflack@math.purdue.edu
Subject: Re: get/setReadOnly broken if default_transaction_read_only on
In-Reply-To: <4FCFB988.2080408@math.purdue.edu>
References: <4FCFB988.2080408@math.purdue.edu>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox