Re: bug in the jdbc driver for postgress 7.0 (ResultSet.java)

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Travis Bauer <trbauer(at)indiana(dot)edu>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: bug in the jdbc driver for postgress 7.0 (ResultSet.java)
Date: 2000-05-25 03:34:04
Message-ID: 200005250334.XAA29745@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

This fix will appear in 7.01, and is in tonight's snapshot. Please let
us know if that does not fix it.

> I think I've found a bug in how the jdbc driver (JDBC2) numbers the rows
> in a result set. According to Sun's documentation for the ResultSet
> interface, the rows in a result set should be numbered starting with
> 1. However, the ResultSet.java's first() routine set's current_row to
> 0. The odd thing is that beforeFirst() also sets current_row to 0, it
> just does not load this_row. The bug manifests itself as such:
>
> given ResultSet rs containing two rows:
>
> rs.last();
> System.out.println("Last id is: "+rs.getRow());
> rs.first();
> System.out.println("First id is: "+rs.getRow());
>
> produces the output:
>
> Last id is: 1
> First id is: 0
>
> I think the easiest fix would be to change getRow() so that it returns
> current_row+1, and change beforeFirst so that it sets current_row to
> -1. I'm not sure what other changes need to be made, but since the JDBC
> driver does not allow one to refer directly to row numbers, I can't think
> of any other changes offhand.
>
> Or am I all wet and this is not a bug? Please respond to me directly, as
> I'm not a member of this list.
>
> ----------------------------------------------------------------
> Travis Bauer | CS Grad Student | IU |www.cs.indiana.edu/~trbauer
> ----------------------------------------------------------------
>
>

--
Bruce Momjian | http://www.op.net/~candle
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Travis Bauer 2000-05-25 16:51:10 jdbc2 bug in absolute (ResultSet.java)
Previous Message Travis Bauer 2000-05-25 02:50:20 bug in the jdbc driver for postgress 7.0 (ResultSet.java)