"M. Bastin" <marcbastin(at)mindspring(dot)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
In response to
pgsql-novice by date
|Next:||From: Tom Lane||Date: 2004-07-10 04:29:05|
|Subject: Re: array in postgre |
|Previous:||From: Tom Lane||Date: 2004-07-10 03:16:26|
|Subject: Re: table inheritance and polymorphic functions |