Thread: setFetchSize() bug?

setFetchSize() bug?

From
Felipe Schnack
Date:
I just found something about the way setFetchSize() is implemented in current CVS version of the driver, I'm
wonderingif it's a bug, probably it is. I just found that if you don't use server-side preparedstatements, the
followingexception is thrown (I sent this same exception earlier today). This is a bug? I can't understand it very
well....seems to me that the driver uses the statement's name as the cursor name?? 

java.sql.SQLException: ERROR:  parser: parse error at or near "null" at character 23
    at org.postgresql.core.QueryExecutor.executeV2(QueryExecutor.java:286)
    at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:104)
    at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:66)
    at org.postgresql.jdbc1.AbstractJdbc1ResultSet.next(AbstractJdbc1ResultSet.java:135)
    at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:135)


--

 /~\ The ASCII        Felipe Schnack (felipes@ritterdosreis.br)
 \ / Ribbon Campaign  Analista de Sistemas
  X  Against HTML     Cel.: 51-91287530
 / \ Email!           Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter@ritterdosreis.br
Fone: 51-32303341

Re: setFetchSize() bug?

From
Felipe Schnack
Date:
That's not the problem, I'm already with autocommit set to false... the problem is elsewhere. I believe it's on
serverside prepared statements (or the lack of it) use. 

On 04 Aug 2003 15:24:26 -0400
Kim Ho <kho@redhat.com> wrote:

> Hi,
>
> You might want to do a
>     con.setAutoCommit(false);
> to force it to use cursors.
>
>
> As you put it, the driver is probably not using server side prepared
> statements or cursors.
>
> Cheers,
>
> Kim
>
> On Mon, 2003-08-04 at 11:18, Felipe Schnack wrote:
> >   I just found something about the way setFetchSize() is implemented in current CVS version of the driver, I'm
wonderingif it's a bug, probably it is. I just found that if you don't use server-side preparedstatements, the
followingexception is thrown (I sent this same exception earlier today). This is a bug? I can't understand it very
well....seems to me that the driver uses the statement's name as the cursor name?? 
> >
> > java.sql.SQLException: ERROR:  parser: parse error at or near "null" at character 23
> >     at org.postgresql.core.QueryExecutor.executeV2(QueryExecutor.java:286)
> >     at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:104)
> >     at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:66)
> >     at org.postgresql.jdbc1.AbstractJdbc1ResultSet.next(AbstractJdbc1ResultSet.java:135)
> >     at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:135)
> --
> Kim Ho <kho@redhat.com>
>


--

 /~\ The ASCII        Felipe Schnack (felipes@ritterdosreis.br)
 \ / Ribbon Campaign  Analista de Sistemas
  X  Against HTML     Cel.: 51-91287530
 / \ Email!           Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter@ritterdosreis.br
Fone: 51-32303341

Re: setFetchSize() bug?

From
Fernando Nasser
Date:
There isn't enough information to debug this in the stack trace.  This
code seems fine and is there for some time already.

Do you have a small example that could be used to reproduce the problem?
  It would make it easier for us to track it down.

Regards,
Fernando

Felipe Schnack wrote:
>   I just found something about the way setFetchSize() is implemented in current CVS version of the driver, I'm
wonderingif it's a bug, probably it is. I just found that if you don't use server-side preparedstatements, the
followingexception is thrown (I sent this same exception earlier today). This is a bug? I can't understand it very
well....seems to me that the driver uses the statement's name as the cursor name?? 
>
> java.sql.SQLException: ERROR:  parser: parse error at or near "null" at character 23
>     at org.postgresql.core.QueryExecutor.executeV2(QueryExecutor.java:286)
>     at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:104)
>     at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:66)
>     at org.postgresql.jdbc1.AbstractJdbc1ResultSet.next(AbstractJdbc1ResultSet.java:135)
>     at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:135)
>
>


--
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


Re: setFetchSize() bug?

From
Felipe Schnack
Date:
I don't know if Kim Ho's patch solved the problem... it was already applied? I could test it if it is.
  (He sent it today)

On Tue, 05 Aug 2003 10:21:07 -0400
Fernando Nasser <fnasser@redhat.com> wrote:

> There isn't enough information to debug this in the stack trace.  This
> code seems fine and is there for some time already.
>
> Do you have a small example that could be used to reproduce the problem?
>   It would make it easier for us to track it down.
>
> Regards,
> Fernando
>
> Felipe Schnack wrote:
> >   I just found something about the way setFetchSize() is implemented in current CVS version of the driver, I'm
wonderingif it's a bug, probably it is. I just found that if you don't use server-side preparedstatements, the
followingexception is thrown (I sent this same exception earlier today). This is a bug? I can't understand it very
well....seems to me that the driver uses the statement's name as the cursor name?? 
> >
> > java.sql.SQLException: ERROR:  parser: parse error at or near "null" at character 23
> >     at org.postgresql.core.QueryExecutor.executeV2(QueryExecutor.java:286)
> >     at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:104)
> >     at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:66)
> >     at org.postgresql.jdbc1.AbstractJdbc1ResultSet.next(AbstractJdbc1ResultSet.java:135)
> >     at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:135)
> >
> >
>
>
> --
> Fernando Nasser
> Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
> 2323 Yonge Street, Suite #300
> Toronto, Ontario   M4P 2C9
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org


--

 /~\ The ASCII        Felipe Schnack (felipes@ritterdosreis.br)
 \ / Ribbon Campaign  Analista de Sistemas
  X  Against HTML     Cel.: 51-91287530
 / \ Email!           Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter@ritterdosreis.br
Fone: 51-32303341

Re: setFetchSize() bug?

From
Kim Ho
Date:
I am fairly sure it is because the query is not sent as a server side
prepared statement OR as a cursor.

Therefore, the statement name is not set.

That being said, I would like to see an example of the code that
produces the error (in case it differs from the way that I'm reproducing
the error).

Cheers,

Kim

On Tue, 2003-08-05 at 10:21, Fernando Nasser wrote:
> There isn't enough information to debug this in the stack trace.  This
> code seems fine and is there for some time already.
>
> Do you have a small example that could be used to reproduce the problem?
>   It would make it easier for us to track it down.
>
> Regards,
> Fernando
>
> Felipe Schnack wrote:
> >   I just found something about the way setFetchSize() is implemented in current CVS version of the driver, I'm
wonderingif it's a bug, probably it is. I just found that if you don't use server-side preparedstatements, the
followingexception is thrown (I sent this same exception earlier today). This is a bug? I can't understand it very
well....seems to me that the driver uses the statement's name as the cursor name?? 
> >
> > java.sql.SQLException: ERROR:  parser: parse error at or near "null" at character 23
> >     at org.postgresql.core.QueryExecutor.executeV2(QueryExecutor.java:286)
> >     at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:104)
> >     at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:66)
> >     at org.postgresql.jdbc1.AbstractJdbc1ResultSet.next(AbstractJdbc1ResultSet.java:135)
> >     at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:135)
> >
> >
>


Re: setFetchSize() bug?

From
Fernando Nasser
Date:
Felipe Schnack wrote:
>   I don't know if Kim Ho's patch solved the problem... it was already applied? I could test it if it is.
>   (He sent it today)
>

The only way to be sure it is the right fix would be with some test
(which we would also add to the regression tests so it does not come
back again after we fix it).

I strongly suspect that the creation of the cursor statement for your
query failed.  It currently fails silently!  Yes, I know this is bad: I
have added a FIXME to my code.

Check if your query does not happen to be a DECLARE or a multiple query
(i.e., two or more queries separated by ';').  It would produce the
result you've seen.

Cheers,
Fernando


> On Tue, 05 Aug 2003 10:21:07 -0400
> Fernando Nasser <fnasser@redhat.com> wrote:
>
>
>>There isn't enough information to debug this in the stack trace.  This
>>code seems fine and is there for some time already.
>>
>>Do you have a small example that could be used to reproduce the problem?
>>  It would make it easier for us to track it down.
>>
>>Regards,
>>Fernando
>>
>>Felipe Schnack wrote:
>>
>>>  I just found something about the way setFetchSize() is implemented in current CVS version of the driver, I'm
wonderingif it's a bug, probably it is. I just found that if you don't use server-side preparedstatements, the
followingexception is thrown (I sent this same exception earlier today). This is a bug? I can't understand it very
well....seems to me that the driver uses the statement's name as the cursor name?? 
>>>
>>>java.sql.SQLException: ERROR:  parser: parse error at or near "null" at character 23
>>>    at org.postgresql.core.QueryExecutor.executeV2(QueryExecutor.java:286)
>>>    at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:104)
>>>    at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:66)
>>>    at org.postgresql.jdbc1.AbstractJdbc1ResultSet.next(AbstractJdbc1ResultSet.java:135)
>>>    at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:135)
>>>
>>>
>>
>>
>>--
>>Fernando Nasser
>>Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
>>2323 Yonge Street, Suite #300
>>Toronto, Ontario   M4P 2C9
>>
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
>
>


--
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9