SELECT ... FOR UPDATE and ResultSet

From: Jeffrey Tenny <jeffrey(dot)tenny(at)comcast(dot)net>
To: postgres jdbc <pgsql-jdbc(at)postgresql(dot)org>
Subject: SELECT ... FOR UPDATE and ResultSet
Date: 2004-01-02 01:26:49
Message-ID: 3FF4C8D9.10102@comcast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

PostgreSQL will lock the rows identified by SELECT ... FOR UPDATE
even if I don't do anything with the ResultSet after
statement.executeQuery(),
at least in simple tests.

Is this the semantically correct result from a database standards
standpoint?
Can I count on this behavior for PostgreSQL? Or will it fail to lock
all rows if
I have a sufficiently large ResultSet and Connection.setFetchSize() does
it's magic?

I notice that there is PostgreSQL documentation saying that the FOR
UPDATE stuff
logically happens after LIMIT. The same logic might then conceptually
apply to ResultSets that don't acquire all query results from the server.

Thanks for any tips.

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tom Lane 2004-01-02 02:12:17 Re: SELECT ... FOR UPDATE and ResultSet
Previous Message Jeffrey Tenny 2004-01-02 01:00:07 PostgreSQL design question