If PostgreSQL failed to compile on your computer or you found a bug that
is likely to be specific to one platform then please fill out this form
and e-mail it to [EMAIL PROTECTED]
To report any other bug, fill out the form below and e-mail it to
[EMAIL PROTECTED]
If you not only found the problem but solved it and generated a patch
then e-mail it to [EMAIL PROTECTED] instead. Please use the
command "diff -c" to generate the patch.
You may also enter a bug report at http://www.postgresql.org/ instead of
e-mail-ing this form.
============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================
Your name : Chris Pesarchick
Your email address : [EMAIL PROTECTED]
System Configuration
---------------------
Architecture (example: Intel Pentium) : Intel IBM A22m Laptop
Operating System (example: Linux 2.4.18) : Linux
PostgreSQL version (example: PostgreSQL-7.4.2): PostgreSQL-7.4.2
Compiler used (example: gcc 2.95.2) : 3.3-23
JDBC Driver : PostgreSQL 7.4 (Build 213)
Please enter a FULL description of your problem:
------------------------------------------------
I am having an issue with the driver when I do a deleteRow using a
ResultSet record. It skips records.
For example, if I have seven records and I select all of them in a
ResultSet, spin through each one and call deleteRow() the result is wrong.
The 1st, 3rd, 5th, and 7th records are deleted, but the others are not.
Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------
/**
* This is an example of using the deleteRow.
* Here are some of the things I found. For this method to work
* there must be a few things done.
* 1. Must use CONCUR_UPDATABLE in the createStatement
* 2. There must be primary keys, if you don't have any, use 'oid'
field
* in the select that creates the resultset.
* @throws SQLException
*/
public void deleteRow() throws SQLException {
System.out.println("Start deleteRow");
Statement statement = null;
ResultSet resultSet = null;
int i = 1;
statement =
connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql = "select oid, * from perf_data where
username='cpesarchick'"; //This can be any select statement
//statement.setFetchSize(1000);
resultSet = statement.executeQuery( sql );
resultSet.last();
System.out.println("row count: " + resultSet.getRow());
resultSet.beforeFirst();
while ( resultSet.next()) {
System.out.println( "row #: " + resultSet.getRow());
System.out.println("Deleting Row:" + i);
resultSet.deleteRow();
System.out.println("Done Deleting Row:" + i);
System.out.println( "row #: " + resultSet.getRow());
i++;
}
resultSet.close();
statement.close();
System.out.println("End deleteRow");
}
If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------
I don't know, but my suspicions are with the Vector which holds all the
rows in the ResultSet.
This electronic message transmission contains information from a member company of
Westfield Group which is privileged, confidential or otherwise the exclusive property
of the intended recipient or that member company of Westfield Group. This information
is intended for the use of the individual or entity that is the intended recipient.
If you are not the designated recipient, please be aware that any dissemination,
distribution or copying of this communication is strictly prohibited. If you have
received this electronic transmission in error, please notify us by telephone at
1.800.243.0210, extension 2153, or by electronic e-mail ([EMAIL PROTECTED]) and
promptly destroy the original transmission.
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faqs/FAQ.html