Re: Extended Query: Parse Command: syntax?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Extended Query: Parse Command: syntax?
Дата
Msg-id 2618.1089432857@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Extended Query: Parse Command: syntax?  ("M. Bastin" <marcbastin@mindspring.com>)
Список pgsql-novice
"M. Bastin" <marcbastin@mindspring.com> writes:
> At 4:26 PM +0200 7/8/04, M. Bastin wrote:
>> When you send the query to be parsed I presume you must somehow tell
>> which elements of it are parameters.  How do you do this?
>> e.g.:   SELECT name, phone FROM friends WHERE age > 25;
>> How would I write this if "name" and "25" must be parameters?

    SELECT name, phone FROM friends WHERE $1 > $2;

>> Or if
>> the operator ">" should be a parameter or modifiable in another way?

You cannot make an operator a parameter.  It's not very clear what it
would mean to prepare a query in which some operators remain unknown ---
certainly the planner could not produce any useful plan for it.

> Can "age > 25" as a whole be a parameter?

Only if you are prepared to supply a boolean value for it at Bind time.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: table inheritance and polymorphic functions
Следующее
От: Tom Lane
Дата:
Сообщение: Re: array in postgre