dbTalk Databases Forums  

[BUGS] BUG #2514: (jdbc driver) Multiple inlined statements with mixed updates and queries return wrong results

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #2514: (jdbc driver) Multiple inlined statements with mixed updates and queries return wrong results in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default [BUGS] BUG #2514: (jdbc driver) Multiple inlined statements with mixed updates and queries return wrong results - 07-06-2006 , 12:49 PM







The following bug has been logged online:

Bug reference: 2514
Logged by: Gilles
Email address: gilles.rayrat (AT) continuent (DOT) com
PostgreSQL version: 8.0.7
Operating system: linux
Description: (jdbc driver) Multiple inlined statements with mixed
updates and queries return wrong results
Details:

jdbc driver: 8.1.405

When issuing this:
statement.execute("SELECT 2;UPDATE foo SET d='babar' where i=1; SELECT 3");
The 2 result returned is wrong. This seems to be a ResultSet containing the
same values as the first RS (it should be an update count)

Here is code to reproduce:

stmt.executeUpdate("CREATE TABLE foo(i integer, d varchar(5))");
stmt.executeUpdate("INSERT INTO foo values(1,'bar')");
boolean isRS = stmt.execute("SELECT 2;UPDATE foo SET d='babar' where
i=1; SELECT 3");
assertTrue(isRS);
ResultSet rs = stmt.getResultSet();
assertTrue(rs.next());
assertEquals(rs.getInt(1), 2);
rs.close();
assertFalse(stmt.getMoreResults()); // <= This fails !
assertEquals(stmt.getUpdateCount(), 1);
assertTrue(stmt.getMoreResults());
rs = stmt.getResultSet();
assertTrue(rs.next());
assertEquals(rs.getInt(1), 3);
rs.close();
stmt.close();

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.