From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "M(dot) Bastin" <marcbastin(at)mindspring(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Extended Query: Parse Command: syntax? |
Date: | 2004-07-10 04:14:17 |
Message-ID: | 2618.1089432857@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
"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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-07-10 04:29:05 | Re: array in postgre |
Previous Message | Tom Lane | 2004-07-10 03:16:26 | Re: table inheritance and polymorphic functions |