Re: [BUGS] BUG #7766: Running a DML statement that affects more than 4 billion rows results in an exception - Mailing list pgsql-jdbc

From Dave Cramer
Subject Re: [BUGS] BUG #7766: Running a DML statement that affects more than 4 billion rows results in an exception
Date
Msg-id CADK3HHJArDFVnYzUcg=dYDU6-jMBqki=r7fjZp=oP5jPPVXOmw@mail.gmail.com
Whole thread Raw
In response to Re: [BUGS] BUG #7766: Running a DML statement that affects more than 4 billion rows results in an exception  (Stefan Reiser <s.reiser@tu-braunschweig.de>)
List pgsql-jdbc
Good points to both. Thank you both for reviewing.


Dave

Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca


On Fri, Jan 11, 2013 at 12:36 PM, Stefan Reiser <s.reiser@tu-braunschweig.de> wrote:
Kris Jurka schrieb:


On Fri, 11 Jan 2013, Dave Cramer wrote:

Ok, I've pushed this fix into master

You've made any failure to parse the affected row count return
SUCCESS_NO_INFO.  Shouldn't you change the integer parsing to a long
parsing and only modify the response if the value is > INT_MAX while still
throwing an exception if we get something that is truly undecipherable?

Kris Jurka


Dave,
I'm completely unfamiliar with the driver's code, so I better won't take part in the further discussion -- just one thing: Now "insert_oid" won't be assigned correctly when the assignment of update_count fails:

[QueryExecutorImpl.java]
            try
            {
                update_count = Integer.parseInt(status.substring(1 + status.lastIndexOf(' ')));
                if (status.startsWith("INSERT"))
                    insert_oid = Long.parseLong(status.substring(1 + status.indexOf(' '),
                                                status.lastIndexOf(' ')));
            }
            catch (NumberFormatException nfe)
            {
                update_count=Statement.SUCCESS_NO_INFO;
            }

better be something like this: ?

            try
            {
                update_count = Integer.parseInt(status.substring(1 + status.lastIndexOf(' ')));
            }
            catch (NumberFormatException nfe)
            {
                update_count=Statement.SUCCESS_NO_INFO;
            }
            try {
                if (status.startsWith("INSERT"))
                    insert_oid = Long.parseLong(status.substring(1 + status.indexOf(' '),
                                                status.lastIndexOf(' ')));
            } catch ( ...
                 // don't know what expected behaviour should be ...
}

regards
Stefan Reiser

pgsql-jdbc by date:

Previous
From: Stefan Reiser
Date:
Subject: Re: [BUGS] BUG #7766: Running a DML statement that affects more than 4 billion rows results in an exception
Next
From: dmp
Date:
Subject: Re: Website Todo List