From: | ChristopherPesarchick(at)westfieldgrp(dot)com |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Bug with deleteRow() for the ResultSet using PostgreSQL 7.4 (Build 213)driver. |
Date: | 2004-06-08 14:04:40 |
Message-ID: | OFAF3E8AD4.BE8438BF-ON85256EAD.004B828F@westfield-cos.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
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 pgsql-ports(at)postgresql(dot)org(dot)
To report any other bug, fill out the form below and e-mail it to
pgsql-bugs(at)postgresql(dot)org(dot)
If you not only found the problem but solved it and generated a patch
then e-mail it to pgsql-patches(at)postgresql(dot)org 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 : ChrisPesarchick(at)westfieldgrp(dot)com
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 (help(at)westfieldgrp(dot)com) and promptly destroy the original transmission.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-06-08 15:18:05 | Re: Fwd: Bug#249083: postgresql: Postgres SIGSEGV if wins in nsswitch.conf |
Previous Message | Fabien COELHO | 2004-06-08 10:29:45 | Re: BUG #1161: User permissions are kept, even if user is |