Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lN10L-0005pQ-OS for pgsql-jdbc@arkaria.postgresql.org; Thu, 18 Mar 2021 22:20:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lN10K-0004nQ-LA for pgsql-jdbc@arkaria.postgresql.org; Thu, 18 Mar 2021 22:20:32 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lN10K-0004nJ-C5 for pgsql-jdbc@lists.postgresql.org; Thu, 18 Mar 2021 22:20:32 +0000 Received: from mail.nqadmin.com ([12.230.133.169]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lN10D-0003az-H6 for pgsql-jdbc@lists.postgresql.org; Thu, 18 Mar 2021 22:20:31 +0000 Received: internal info suppressed Received: (from root@localhost) by mail.nqadmin.com (8.14.7/8.14.7/Submit) id 12IMKNq9005789 for pgsql-jdbc@lists.postgresql.org; Thu, 18 Mar 2021 17:20:23 -0500 Received: from ppasalalinux.nqadmin.com (ppasalalinux.nqadmin.com [192.168.0.234]) by mail.nqadmin.com with SMTP id m7died2zh8hjqycp7eu6b4qyns; for pgsql-jdbc@lists.postgresql.org; Thu, 18 Mar 2021 17:20:23 -0500 (CDT) (envelope-from dbadmin@pangburngroup.com) To: pgsql-jdbc@lists.postgresql.org Reply-To: dbadmin@pangburngroup.com From: Prasanth Subject: Exception while updating result set Message-ID: <472e572d-d1b9-63af-7a47-50c84dafe2ea@pangburngroup.com> Date: Thu, 18 Mar 2021 17:20:23 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------5E20C2DBA316B7D0F624231C" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------5E20C2DBA316B7D0F624231C Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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 --------------5E20C2DBA316B7D0F624231C Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit 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
--------------5E20C2DBA316B7D0F624231C--