Skip site navigation (1) Skip section navigation (2)

Re: ERROR: no value found for parameter 1 with JDBC and Explain Analyze

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Virag Saksena" <v_saks(at)hotmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: ERROR: no value found for parameter 1 with JDBC and Explain Analyze
Date: 2005-11-19 00:06:20
Message-ID: 13280.1132358780@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-performance
"Virag Saksena" <v_saks(at)hotmail(dot)com> writes:
> ERROR: no value found for parameter 1

> Here is sample code which causes this exception ...
>   pst=prodconn.prepareStatement("explain analyze select count(*) from 
> jam_heaprel r where heap_id = ? and parentaddr = ?");

I don't think EXPLAIN can take parameters (most of the "utility"
statements don't take parameters).

The usual workaround is to use PREPARE:

	PREPARE foo(paramtype,paramtype) AS SELECT ...;
	EXPLAIN EXECUTE foo(x,y);

This will generate the same parameterized plan as you'd get from the
other way, so it's a reasonable approximation to the behavior with
JDBC parameters.

			regards, tom lane

In response to

pgsql-performance by date

Next:From: Mark KirkwoodDate: 2005-11-19 02:27:49
Subject: Re: Hardware/OS recommendations for large databases (
Previous:From: Luke LonerganDate: 2005-11-19 00:05:59
Subject: Re: Hardware/OS recommendations for large databases (

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group