Re: UPDATE ... CURRENT OF cursorname

Lists: pgsql-jdbc
From: "Richard Broersma" <richard(dot)broersma(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: UPDATE ... CURRENT OF cursorname
Date: 2008-09-01 17:11:03
Message-ID: 396486430809011011s2bc0b35eh43b2e4a9de116a4a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

I looking for an explination of how named cursor updates actually
work. For example from the following link:
http://java.sun.com/javase/6/docs/technotes/guides/jdbc/getstart/resultset.html

the code seems to imply that all rows from a name cursor will be update.

...
stmt.setCursorName("x");
ResultSet rs = stmt.executeQuery(
"SELECT . . . FROM . . . WHERE . . . FOR UPDATE . . .")
String cursorName = rs.getCursorName;
int updateCount = stmt2.executeUpdate(
"UPDATE . . . WHERE CURRENT OF " + cursorName);
...

However from the postgresql manual, the verbase seems to indicate that
only the record currently pointed to in the cursor is updated.
http://www.postgresql.org/docs/8.3/interactive/sql-update.html

...
cursor_name
The name of the cursor to use in a WHERE CURRENT OF condition. The
->row<- to be updated is the one most recently fetched from this
cursor.
...

--
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug


From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Richard Broersma <richard(dot)broersma(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: UPDATE ... CURRENT OF cursorname
Date: 2008-09-01 22:21:39
Message-ID: 48BC6AF3.3070007@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Richard Broersma wrote:

> stmt.setCursorName("x");

The postgresql JDBC driver does not support positioned updates (as the
metadata will tell you), and setCursorName() is completely ignored.

-O


From: "Richard Broersma" <richard(dot)broersma(at)gmail(dot)com>
To: "Oliver Jowett" <oliver(at)opencloud(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: UPDATE ... CURRENT OF cursorname
Date: 2008-09-01 22:28:21
Message-ID: 396486430809011528r2a1237c0w77fb6243e38dfc16@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Mon, Sep 1, 2008 at 3:21 PM, Oliver Jowett <oliver(at)opencloud(dot)com> wrote:
> Richard Broersma wrote:
>
>> stmt.setCursorName("x");
>
> The postgresql JDBC driver does not support positioned updates (as the
> metadata will tell you), and setCursorName() is completely ignored.

Thanks!, since I am only in the learning/reading stage, I hadn't
performed any tests. However, if the feature were to be added some
the future, what would the attended affect be?

--
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug


From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Richard Broersma <richard(dot)broersma(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: UPDATE ... CURRENT OF cursorname
Date: 2008-09-01 22:36:38
Message-ID: 48BC6E76.6050402@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Richard Broersma wrote:
> On Mon, Sep 1, 2008 at 3:21 PM, Oliver Jowett <oliver(at)opencloud(dot)com> wrote:
>> Richard Broersma wrote:
>>
>>> stmt.setCursorName("x");
>> The postgresql JDBC driver does not support positioned updates (as the
>> metadata will tell you), and setCursorName() is completely ignored.
>
> Thanks!, since I am only in the learning/reading stage, I hadn't
> performed any tests. However, if the feature were to be added some
> the future, what would the attended affect be?

Well, frankly, I doubt it will be added in the future, because the
driver does not map resultset operations directly to cursor operations
on the server.

-O