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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: ERROR: no value found for parameter 1 with JDBC and Explain Analyze
Дата
Msg-id 13280.1132358780@sss.pgh.pa.us
обсуждение исходный текст
Ответ на ERROR: no value found for parameter 1 with JDBC and Explain Analyze  ("Virag Saksena" <v_saks@hotmail.com>)
Список pgsql-performance
"Virag Saksena" <v_saks@hotmail.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

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

Предыдущее
От: "Luke Lonergan"
Дата:
Сообщение: Re: Hardware/OS recommendations for large databases (
Следующее
От: Mark Kirkwood
Дата:
Сообщение: Re: Hardware/OS recommendations for large databases (