Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aCU1N-0000kA-75 for pgsql-jdbc@arkaria.postgresql.org; Fri, 25 Dec 2015 15:11:09 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aCU1M-0001xr-Pk for pgsql-jdbc@arkaria.postgresql.org; Fri, 25 Dec 2015 15:11:08 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aCU0r-0000q1-3G for pgsql-jdbc@postgresql.org; Fri, 25 Dec 2015 15:10:37 +0000 Received: from xs.dms.at ([78.142.176.1]) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1aCU0n-00011t-JS for pgsql-jdbc@postgresql.org; Fri, 25 Dec 2015 15:10:35 +0000 Received: from localhost (unknown [127.0.0.1]) by xs.dms.at (Postfix) with ESMTP id 65B603837C for ; Fri, 25 Dec 2015 15:10:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at dms.at Received: from xs.dms.at ([127.0.0.1]) by localhost (mainsrv.dms.at [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id e3c4GKhfONY6 for ; Fri, 25 Dec 2015 16:10:30 +0100 (CET) Received: from [192.168.191.106] (hacheni.kopileft.com [192.168.191.106]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by xs.dms.at (Postfix) with ESMTPSA id 3BF7E37CCB for ; Fri, 25 Dec 2015 16:10:29 +0100 (CET) Message-ID: <567D5C7B.3060402@kopileft.com> Date: Fri, 25 Dec 2015 16:10:51 +0100 From: =?ISO-8859-1?Q?H=E9di_HACHENI?= User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: JDBC and positioned updates Content-Type: multipart/alternative; boundary="------------070405080502030904070409" X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org This is a multi-part message in MIME format. --------------070405080502030904070409 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Dear, We are using PostgreSQL (server version 9.4.5) with a JDBC connection (version 9.1.x). It seems that JDBC implementation does not support the setting of a cursor name for an SQL statement. The following example will be used to illustrate the problem. Consider that we have the SELECT statement below : SELECT Column1, Column2 Column3, Column4 FROM MyTable *FOR UPDATE* Then, we want to perform a positioned update based on the SELECT above : UPDATE MyTable SET Column1 = new_value, Column3 = new_value *WHERE CURRENT OF* cursor_name To achieve our goal, we would use the java.sql.Statement#*setCursorName*(String) to reference the SELECT statement. Then, using the java.sql.ResultSet#*getCursorName*() to get the used cursor name for the statement. Nevertheless, the java.sql.ResultSet#getCursorName() returns *null* as value and even the java.sql.Statement#setCursorName(String) method seems to be not implemented. Based on what explained above, we would like to ask four major questions : * Is there any plan for the implementation of the mentioned feature in further JDBC versions ? * Is there any alternative solution that aid us to perform a positioned update using JDBC ? * If the JDBC implementation should be modified, can you guide us or give us ideas to get started ? * If we are obliged to implement the feature by modifying the JDBC implementation, is there any interest in this modified JDBC ? Thanks for your feedback. Best regards, Hédi HACHENI kopiLeft Services --------------070405080502030904070409 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
Dear,

We are using PostgreSQL (server version 9.4.5) with a JDBC connection (version 9.1.x).

It seems that JDBC implementation does not support the setting of a cursor name for an SQL statement. The following example will be used to illustrate the problem.

Consider that we have the SELECT statement below :

    SELECT    Column1,
                    Column2
                    Column3,
                    Column4
    FROM       MyTable
    FOR UPDATE

Then, we want to perform a positioned update based on the SELECT above :

    UPDATE    MyTable
    SET           Column1 = new_value,
                     Column3 = new_value
    WHERE CURRENT OF cursor_name

To achieve our goal, we would use the java.sql.Statement#setCursorName(String) to reference the SELECT statement. Then, using the java.sql.ResultSet#getCursorName() to get the used cursor name for the statement. Nevertheless, the java.sql.ResultSet#getCursorName() returns null as value and even the java.sql.Statement#setCursorName(String) method seems to be not implemented.

Based on what explained above, we would like to ask four major questions :

  • Is there any plan for the implementation of the mentioned feature in further JDBC versions ?
  • Is there any alternative solution that aid us to perform a positioned update using JDBC ?
  • If the JDBC implementation should be modified, can you guide us or give us ideas to get started ?
  • If we are obliged to implement the feature by modifying the JDBC implementation, is there any interest in this modified JDBC ?

Thanks for your feedback.

Best regards,
Hédi HACHENI
kopiLeft Services
--------------070405080502030904070409--