Обсуждение: parameterized fetch

Поиск
Список
Период
Сортировка

parameterized fetch

От
"Merlin Moncure"
Дата:
I've noticed that trying to parameterize a fetch statement via
ExecParams returns a syntax error:

fetch $1 from my_cursor;

This is not really a big deal, but maybe it should be documented which
statements can be parameterized and which can't (I take it that any
statement that can be prepared can be parameterized;

prepare test as fetch 1 from my_cursor;
also returns a syntax error;

Merlin



Re: parameterized fetch

От
Oliver Jowett
Дата:
Merlin Moncure wrote:
> I've noticed that trying to parameterize a fetch statement via
> ExecParams returns a syntax error:
> 
> fetch $1 from my_cursor;
> 
> This is not really a big deal, but maybe it should be documented which
> statements can be parameterized and which can't

Currently the documentation is "the backend's grammar". You can only put
parameters where there is a PARAM node, which currently means "anywhere
you can put a c_expr". So if you can replace something with an
expression, you can probably also replace it with a parameter.

-O