pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dave Cramer <pg@fastcrypt.com>
To: List <pgsql-jdbc@postgresql.org>
Subject: un-named prepared statement wierdness
Date: Thu, 27 Apr 2006 08:26:05 -0400
Message-ID: <3D66A8AE-1183-41F6-A940-85DEEF8D57BB@fastcrypt.com> (raw)

I have a test case which does the following in jdbc.


	PreparedStatement cur_def_stmt = conn.prepareStatement("declare  
registrar_c cursor for select name from epp_dummy where id = ?");
         PreparedStatement cur_fetch_stmt = conn.prepareStatement 
("fetch forward 1000 from registrar_c");

         cur_def_stmt.setInt(1, 18);
         cur_def_stmt.execute();
         ResultSet resultSet = cur_fetch_stmt.executeQuery();

         while(resultSet.next())
         {
             System.err.println(resultSet.getString(1));
         }

         conn.execSQLUpdate(";commit;");

On 7.4.x servers it errors out with

ERROR: no value found for parameter 1
   Location: File: execQual.c, Routine: ExecEvalParam, Line: 518
   Server SQLState: 42704

On 8.1.x servers it works fine ?

Here are the respective traces

7.4

simple execute, handler=org.postgresql.jdbc2.AbstractJdbc2Statement 
$StatementResultHandler@57ea4a, maxRows=0, fetchSize=0, flags=23
  FE=> Parse(stmt=null,query="begin",oids={})
  FE=> Bind(stmt=null,portal=null)
  FE=> Execute(portal=null,limit=1)
  FE=> Sync
  <=BE ParseComplete [null]
  <=BE BindComplete [null]
  <=BE CommandStatus(BEGIN)
  <=BE ReadyForQuery(T)
simple execute, handler=org.postgresql.jdbc2.AbstractJdbc2Statement 
$StatementResultHandler@568fb5, maxRows=0, fetchSize=0, flags=17
  FE=> Parse(stmt=null,query="declare registrar_c cursor for select  
name from epp_dummy where id = $1",oids={23})
  FE=> Bind(stmt=null,portal=null,$1=<18>)
  FE=> Describe(portal=null)
  FE=> Execute(portal=null,limit=0)
  FE=> Sync
  <=BE ParseComplete [null]
  <=BE BindComplete [null]
  <=BE NoData
  <=BE CommandStatus(DECLARE CURSOR)
  <=BE ReadyForQuery(T)
simple execute, handler=org.postgresql.jdbc2.AbstractJdbc2Statement 
$StatementResultHandler@199939, maxRows=0, fetchSize=0, flags=17
  FE=> Parse(stmt=null,query="fetch forward 1000 from  
registrar_c",oids={})
  FE=> Bind(stmt=null,portal=null)
  FE=> Describe(portal=null)
  FE=> Execute(portal=null,limit=0)
  FE=> Sync
  <=BE ParseComplete [null]
  <=BE BindComplete [null]
  <=BE RowDescription(1)


8.1

simple execute, handler=org.postgresql.jdbc2.AbstractJdbc2Statement 
$StatementResultHandler@4a7df6, maxRows=0, fetchSize=0, flags=23
  FE=> Parse(stmt=null,query="begin",oids={})
  FE=> Bind(stmt=null,portal=null)
  FE=> Execute(portal=null,limit=1)
  FE=> Sync
  <=BE ParseComplete [null]
  <=BE BindComplete [null]
  <=BE CommandStatus(BEGIN)
  <=BE ReadyForQuery(T)
simple execute, handler=org.postgresql.jdbc2.AbstractJdbc2Statement 
$StatementResultHandler@2e323, maxRows=0, fetchSize=0, flags=17
  FE=> Parse(stmt=null,query="declare registrar_c cursor for select  
name from epp_dummy where id = $1",oids={23})
  FE=> Bind(stmt=null,portal=null,$1=<18>)
  FE=> Describe(portal=null)
  FE=> Execute(portal=null,limit=0)
  FE=> Sync
  <=BE ParseComplete [null]
  <=BE BindComplete [null]
  <=BE NoData
  <=BE CommandStatus(DECLARE CURSOR)
  <=BE ReadyForQuery(T)
simple execute, handler=org.postgresql.jdbc2.AbstractJdbc2Statement 
$StatementResultHandler@221e9e, maxRows=0, fetchSize=0, flags=17
  FE=> Parse(stmt=null,query="fetch forward 1000 from  
registrar_c",oids={})
  FE=> Bind(stmt=null,portal=null)
  FE=> Describe(portal=null)
  FE=> Execute(portal=null,limit=0)
  FE=> Sync
  <=BE ParseComplete [null]
  <=BE BindComplete [null]
  <=BE RowDescription(1)
  <=BE DataRow
  <=BE CommandStatus(FETCH)
  <=BE ReadyForQuery(T)
simple execute, handler=org.postgresql.jdbc2.AbstractJdbc2Statement 
$StatementResultHandler@701bdc, maxRows=0, fetchSize=0, flags=23
  FE=> Parse(stmt=null,query="commit",oids={})
  FE=> Bind(stmt=null,portal=null)
  FE=> Execute(portal=null,limit=1)
  FE=> Sync
  <=BE ParseComplete [null]
  <=BE BindComplete [null]
  <=BE CommandStatus(COMMIT)
  <=BE ReadyForQuery(I)
  FE=> Terminate


I presume this is a bug in the 7.4 server, but need some clarification.

Dave






view thread (2+ messages)  latest in thread

Message-ID: <3D66A8AE-1183-41F6-A940-85DEEF8D57BB@fastcrypt.com>
Permalink:  ../3D66A8AE-1183-41F6-A940-85DEEF8D57BB@fastcrypt.com/
Also on:    postgresql.org/message-id/3D66A8AE-1183-41F6-A940-85DEEF8D57BB@fastcrypt.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: pg@fastcrypt.com
  Subject: Re: un-named prepared statement wierdness
  In-Reply-To: <3D66A8AE-1183-41F6-A940-85DEEF8D57BB@fastcrypt.com>
  References: <3D66A8AE-1183-41F6-A940-85DEEF8D57BB@fastcrypt.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox