Re: [RFC] How about changing the default value of defaultRowFetchSize? - Mailing list pgsql-jdbc

From Dave Cramer
Subject Re: [RFC] How about changing the default value of defaultRowFetchSize?
Date
Msg-id CADK3HHJPyAtomOsds9CbxcFQjyN3t3Sc25vMEHXPA6PXDQwwZg@mail.gmail.com
Whole thread Raw
In response to Re: [RFC] How about changing the default value of defaultRowFetchSize?  (Mark Rotteveel <mark@lawinegevaar.nl>)
List pgsql-jdbc
On 20 October 2016 at 13:51, Mark Rotteveel <mark@lawinegevaar.nl> wrote:
On 20-10-2016 17:59, Jorge Solórzano wrote:
On Thu, Oct 20, 2016 at 6:53 AM, Mark Rotteveel <mark@lawinegevaar.nl
<mailto:mark@lawinegevaar.nl>> wrote:


    In other words, PostgreSQL JDBC could
    ​​
    leave the default at 0, but then use a default fetch size.



That's seems wrong, the Fetch Size should be correctly reported, the
defaultRowFetchSize property can be changed to 100 but a call to
getFetchSize() should return 100 not 0.

Based on the driver docs:
"defaultRowFetchSize: Default parameter for
java.sql.Statement#getFetchSize(). A value of 0 means that need fetch
all rows at once"

The value of 0 should be used to fetch all rows, if we ​leave the
default at 0 and handle internally that as 100 (and reporting it as 0)
it is a wrong behavior.

My reply was purely from the perspective of the JDBC specification, not how the PostgreSQL JDBC driver currently implements it.

According to the JDBC specification:

"The methods getFetchDirection and getFetchSize return the current value of the hints. If either of these methods is called before the corresponding setter method has been called, the value returned is implementation-defined."

In other words, the default fetch size is implementation defined, furthermore the javadoc of Statement.setFetchSize implies that setting it to value 0 will revert to the default (whatever that is).

Even more of an argument to leave it returning 0 unless it is explicitly set





pgsql-jdbc by date:

Previous
From: Mark Rotteveel
Date:
Subject: Re: [RFC] How about changing the default value ofdefaultRowFetchSize?
Next
From: Mark Rotteveel
Date:
Subject: Re: [RFC] How about changing the default value ofdefaultRowFetchSize?