pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hédi HACHENI <hacheni@kopileft.com>
To: pgsql-jdbc@postgresql.org
Subject: JDBC and positioned updates
Date: Fri, 25 Dec 2015 16:10:51 +0100
Message-ID: <567D5C7B.3060402@kopileft.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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

view thread (8+ messages)  latest in thread

Message-ID: <567D5C7B.3060402@kopileft.com>
Permalink:  ../567D5C7B.3060402@kopileft.com/
Also on:    postgresql.org/message-id/567D5C7B.3060402@kopileft.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: hacheni@kopileft.com
  Subject: Re: JDBC and positioned updates
  In-Reply-To: <567D5C7B.3060402@kopileft.com>
  References: <567D5C7B.3060402@kopileft.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