Re: [RFC] How about changing the default value of defaultRowFetchSize?

Поиск
Список
Период
Сортировка
От Mark Rotteveel
Тема Re: [RFC] How about changing the default value of defaultRowFetchSize?
Дата
Msg-id ef329e36-914c-7b66-4bec-d49974dc2e3c@lawinegevaar.nl
обсуждение исходный текст
Ответ на Re: [RFC] How about changing the default value of defaultRowFetchSize?  (Jorge Solórzano <jorsol@gmail.com>)
Ответы Re: [RFC] How about changing the default value of defaultRowFetchSize?
Re: [RFC] How about changing the default value of defaultRowFetchSize?
Список pgsql-jdbc
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).

Reading my previous reply back, I could have formulated a bit better,
but what I meant to say is that the fact that PostgreSQL current uses
"fetch all" as the default is not at all mandated by the standard, and
using a different default is perfectly fine from the perspective of JDBC.

However doing that would - for the PostgreSQL JDBC driver - change the
meaning of calling Statement.setFetchSize(0) from "fetch all" to "fetch
with the default fetch size" (although those interpretations are the
same for current versions of the driver).

Mark

--
Mark Rotteveel


В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Jorge Solórzano
Дата:
Сообщение: Re: [RFC] How about changing the default value of defaultRowFetchSize?
Следующее
От: Dave Cramer
Дата:
Сообщение: Re: [RFC] How about changing the default value of defaultRowFetchSize?