pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Prasanth <dbadmin@pangburngroup.com>
To: pgsql-jdbc@lists.postgresql.org
Subject: Exception while updating result set
Date: Thu, 18 Mar 2021 17:20:23 -0500
Message-ID: <472e572d-d1b9-63af-7a47-50c84dafe2ea@pangburngroup.com> (raw)

Hi,

The following code generates an exception shown below. Commenting out the refreshRow() call would solve the issue. This exception happens only in driver versions 42.2.13 and above. Is this a bug in
the driver?

        ResultSet rs = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE ).executeQuery(sql);
        rs.next();
        rs.updateDate("start_date", Date.valueOf("2020-01-01"));
        rs.updateDate("end_date", Date.valueOf("2020-12-31"));
        rs.updateRow();
        rs.refreshRow();
        rs.updateDate("end_date", Date.valueOf("2020-12-30"));
        rs.updateRow(); // Exception occurs at this line.


Exception in thread "main" java.lang.IllegalArgumentException: Attempted to write to readonly tuple
    at org.postgresql.core.Tuple.set(Tuple.java:96)
    at org.postgresql.jdbc.PgResultSet.setRowBufferColumn(PgResultSet.java:1680)
    at org.postgresql.jdbc.PgResultSet.updateRowBuffer(PgResultSet.java:1733)
    at org.postgresql.jdbc.PgResultSet.updateRow(PgResultSet.java:1378)

Thanks,
Prasanth

view thread (7+ messages)  latest in thread

Message-ID: <472e572d-d1b9-63af-7a47-50c84dafe2ea@pangburngroup.com>
Permalink:  ../472e572d-d1b9-63af-7a47-50c84dafe2ea@pangburngroup.com/
Also on:    postgresql.org/message-id/472e572d-d1b9-63af-7a47-50c84dafe2ea@pangburngroup.com

 · 

reply

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: dbadmin@pangburngroup.com
  Subject: Re: Exception while updating result set
  In-Reply-To: <472e572d-d1b9-63af-7a47-50c84dafe2ea@pangburngroup.com>
  References: <472e572d-d1b9-63af-7a47-50c84dafe2ea@pangburngroup.com>

* 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