Thread: updateRow bug fix (possible) and build questions

updateRow bug fix (possible) and build questions

From
"Shawn Green"
Date:
I have a potential fix to a bug we've found in the jdbc drivers that
occurs when you are updating in place:

            1.  If you open a cursor on a table using update in place
and update two or more rows, values from previous updated entries will
be inserted into the following updates - the only workaround is to
update every possible row value for each row (not something I really
want to suggest).

I think I have found the problem and corrected it in the attached java
class (line 1089).  I'm pretty sure that I've got it fixed, but I've
been trying to build it and run it and am running into problems.  I want
to build the jdbc2 version of the driver, but I'm not sure how to do
this.  It isn't really documented, although I'll be the first to admit I
haven't read everythin - I'm basically looking for a shortcut.  The
jdbc3 version doesn't work with JNI - it crashes for some reason.

Thanks,
            Shawn Green



Attachment

Re: updateRow bug fix (possible) and build questions

From
Barry Lind
Date:
Shawn,

On your building problems, if you set JAVA_HOME to point to a 1.2 or 1.3
jdk it will build the jdbc2 version.  Basically ant picks up the jdk you
are pointing to and uses that to determine which version to build.

thanks,
--Barry


Shawn Green wrote:
> I have a potential fix to a bug we've found in the jdbc drivers that
> occurs when you are updating in place:
>
>             1.  If you open a cursor on a table using update in place
> and update two or more rows, values from previous updated entries will
> be inserted into the following updates - the only workaround is to
> update every possible row value for each row (not something I really
> want to suggest).
>
> I think I have found the problem and corrected it in the attached java
> class (line 1089).  I'm pretty sure that I've got it fixed, but I've
> been trying to build it and run it and am running into problems.  I want
> to build the jdbc2 version of the driver, but I'm not sure how to do
> this.  It isn't really documented, although I'll be the first to admit I
> haven't read everythin - I'm basically looking for a shortcut.  The
> jdbc3 version doesn't work with JNI - it crashes for some reason.
>
> Thanks,
>             Shawn Green
>
>
>
>
> ------------------------------------------------------------------------
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html


Re: updateRow bug fix (possible) and build questions

From
Dave Cramer
Date:
Shawn,

Can you send me a context diff of this?

diff -c yourfile oldfile

you need ant to build it.

Dave
On Mon, 2003-03-24 at 11:57, Shawn Green wrote:
> I have a potential fix to a bug we've found in the jdbc drivers that
> occurs when you are updating in place:
>
>             1.  If you open a cursor on a table using update in place
> and update two or more rows, values from previous updated entries will
> be inserted into the following updates - the only workaround is to
> update every possible row value for each row (not something I really
> want to suggest).
>
> I think I have found the problem and corrected it in the attached java
> class (line 1089).  I'm pretty sure that I've got it fixed, but I've
> been trying to build it and run it and am running into problems.  I want
> to build the jdbc2 version of the driver, but I'm not sure how to do
> this.  It isn't really documented, although I'll be the first to admit I
> haven't read everythin - I'm basically looking for a shortcut.  The
> jdbc3 version doesn't work with JNI - it crashes for some reason.
>
> Thanks,
>             Shawn Green
>
>
>
> ______________________________________________________________________
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
--
Dave Cramer <Dave@micro-automation.net>


Re: updateRow bug fix (possible) and build questions

From
Dave Cramer
Date:
Shawn,

Your solution was a tad aggressive, I modified it to just clear the
updates, not the buffer. The patch has been applied to HEAD, and 7.2.3

Thanks,

Dave
On Mon, 2003-03-24 at 11:57, Shawn Green wrote:
> I have a potential fix to a bug we've found in the jdbc drivers that
> occurs when you are updating in place:
>
>             1.  If you open a cursor on a table using update in place
> and update two or more rows, values from previous updated entries will
> be inserted into the following updates - the only workaround is to
> update every possible row value for each row (not something I really
> want to suggest).
>
> I think I have found the problem and corrected it in the attached java
> class (line 1089).  I'm pretty sure that I've got it fixed, but I've
> been trying to build it and run it and am running into problems.  I want
> to build the jdbc2 version of the driver, but I'm not sure how to do
> this.  It isn't really documented, although I'll be the first to admit I
> haven't read everythin - I'm basically looking for a shortcut.  The
> jdbc3 version doesn't work with JNI - it crashes for some reason.
>
> Thanks,
>             Shawn Green
>
>
>
> ______________________________________________________________________
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
--
Dave Cramer <Dave@micro-automation.net>


Re: updateRow bug fix (possible) and build questions

From
Barry Lind
Date:
Shawn,

Can you send a context diff (diff -c) so that we can see what you have
changed?

thanks,
--Barry


Shawn Green wrote:
> I have a potential fix to a bug we've found in the jdbc drivers that
> occurs when you are updating in place:
>
>             1.  If you open a cursor on a table using update in place
> and update two or more rows, values from previous updated entries will
> be inserted into the following updates - the only workaround is to
> update every possible row value for each row (not something I really
> want to suggest).
>
> I think I have found the problem and corrected it in the attached java
> class (line 1089).  I'm pretty sure that I've got it fixed, but I've
> been trying to build it and run it and am running into problems.  I want
> to build the jdbc2 version of the driver, but I'm not sure how to do
> this.  It isn't really documented, although I'll be the first to admit I
> haven't read everythin - I'm basically looking for a shortcut.  The
> jdbc3 version doesn't work with JNI - it crashes for some reason.
>
> Thanks,
>             Shawn Green
>
>
>
>
> ------------------------------------------------------------------------
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html


Re: updateRow bug fix (possible) and build questions

From
"Shawn Green"
Date:
Here is the difference:

*** AbstractJdbc2ResultSet.java Mon Mar 24 11:53:51 2003
--- AbstractJdbc2ResultSet.java.orig    Mon Mar 24 12:59:17 2003
***************
*** 1084,1093 ****
                                if ( Driver.logDebug )
                                        Driver.debug("done updates");

-                               // SMG:  Once the update is complete,
clear the update buffer so it isn't
-                               // applied again...
-                               clearRowBuffer ();
-
                                doingUpdates = false;
                        }
                        catch (Exception e)
--- 1084,1089 ----

-----Original Message-----
From: Barry Lind [mailto:blind@xythos.com]
Sent: March 24, 2003 9:08 PM
To: Shawn Green
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] updateRow bug fix (possible) and build questions

Shawn,

Can you send a context diff (diff -c) so that we can see what you have
changed?

thanks,
--Barry


Shawn Green wrote:
> I have a potential fix to a bug we've found in the jdbc drivers that
> occurs when you are updating in place:
>
>             1.  If you open a cursor on a table using update in place
> and update two or more rows, values from previous updated entries will
> be inserted into the following updates - the only workaround is to
> update every possible row value for each row (not something I really
> want to suggest).
>
> I think I have found the problem and corrected it in the attached java
> class (line 1089).  I'm pretty sure that I've got it fixed, but I've
> been trying to build it and run it and am running into problems.  I
want
> to build the jdbc2 version of the driver, but I'm not sure how to do
> this.  It isn't really documented, although I'll be the first to admit
I
> haven't read everythin - I'm basically looking for a shortcut.  The
> jdbc3 version doesn't work with JNI - it crashes for some reason.
>
> Thanks,
>             Shawn Green
>
>
>
>
>
------------------------------------------------------------------------
>
>
> ---------------------------(end of
broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html


Re: updateRow bug fix (possible) and build questions

From
Dave Cramer
Date:
Shawn,

I checked this in last night slightly modified; your patch would wipe
out the current row values. I changed it from clearRowBuffer to
updateValues.clear();

Dave
On Tue, 2003-03-25 at 09:27, Shawn Green wrote:
> Here is the difference:
>
> *** AbstractJdbc2ResultSet.java Mon Mar 24 11:53:51 2003
> --- AbstractJdbc2ResultSet.java.orig    Mon Mar 24 12:59:17 2003
> ***************
> *** 1084,1093 ****
>                                 if ( Driver.logDebug )
>                                         Driver.debug("done updates");
>
> -                               // SMG:  Once the update is complete,
> clear the update buffer so it isn't
> -                               // applied again...
> -                               clearRowBuffer ();
> -
>                                 doingUpdates = false;
>                         }
>                         catch (Exception e)
> --- 1084,1089 ----
>
> -----Original Message-----
> From: Barry Lind [mailto:blind@xythos.com]
> Sent: March 24, 2003 9:08 PM
> To: Shawn Green
> Cc: pgsql-jdbc@postgresql.org
> Subject: Re: [JDBC] updateRow bug fix (possible) and build questions
>
> Shawn,
>
> Can you send a context diff (diff -c) so that we can see what you have
> changed?
>
> thanks,
> --Barry
>
>
> Shawn Green wrote:
> > I have a potential fix to a bug we've found in the jdbc drivers that
> > occurs when you are updating in place:
> >
> >             1.  If you open a cursor on a table using update in place
> > and update two or more rows, values from previous updated entries will
> > be inserted into the following updates - the only workaround is to
> > update every possible row value for each row (not something I really
> > want to suggest).
> >
> > I think I have found the problem and corrected it in the attached java
> > class (line 1089).  I'm pretty sure that I've got it fixed, but I've
> > been trying to build it and run it and am running into problems.  I
> want
> > to build the jdbc2 version of the driver, but I'm not sure how to do
> > this.  It isn't really documented, although I'll be the first to admit
> I
> > haven't read everythin - I'm basically looking for a shortcut.  The
> > jdbc3 version doesn't work with JNI - it crashes for some reason.
> >
> > Thanks,
> >             Shawn Green
> >
> >
> >
> >
> >
> ------------------------------------------------------------------------
> >
> >
> > ---------------------------(end of
> broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> >
> > http://www.postgresql.org/docs/faqs/FAQ.html
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
--
Dave Cramer <Dave@micro-automation.net>