JDBC and positioned updates - Mailing list pgsql-jdbc

From Hédi HACHENI
Subject JDBC and positioned updates
Date
Msg-id 567D5C7B.3060402@kopileft.com
Whole thread Raw
Responses Re: JDBC and positioned updates  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
List pgsql-jdbc
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

pgsql-jdbc by date:

Previous
From: Glenn Holmer
Date:
Subject: Re: PgJDBC - mvn release
Next
From: Vladimir Sitnikov
Date:
Subject: Re: JDBC and positioned updates