X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 5C35A11F60AE for ; Thu, 27 Apr 2006 09:26:18 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 07783-08 for ; Thu, 27 Apr 2006 09:26:08 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by postgresql.org (Postfix) with SMTP id 98C1711F60A2 for ; Thu, 27 Apr 2006 09:26:06 -0300 (ADT) Received: (qmail 30080 invoked from network); 27 Apr 2006 12:26:06 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 27 Apr 2006 12:26:06 -0000 Mime-Version: 1.0 (Apple Message framework v749.3) Content-Transfer-Encoding: 7bit Message-Id: <3D66A8AE-1183-41F6-A940-85DEEF8D57BB@fastcrypt.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: List From: Dave Cramer Subject: un-named prepared statement wierdness Date: Thu, 27 Apr 2006 08:26:05 -0400 X-Mailer: Apple Mail (2.749.3) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200604/167 X-Sequence-Number: 15101 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