It looks like you need a customized version of AExpr Node.
In the backend parser, an AExpr Node is constructed against each given
WHERE expression. You can store the weight along with the expression.
Further, don't forget to upgrade the copy functions and equal
functions for AExpr if you want to take this weight value all the way
upto the executor.


--Imad
www.EnterpriseDB.com


On 7/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Hi all,

I want to pass additional weight info from the WHERE clause to the executor and 
I hope someone can help me with this.

I accept clauses like the following

WHERE (foo='a'){1}
WHERE (foo='a'){1} OR (bar='b'){2}
WHERE ((foo='a'){1} OR (bar='b'){2})){42} OR (baz='c'){3}

where the {} takes an integer as a weight that is attached to the preceding 
(partial) condition.

In the executor, I need to access (1) the logical value of and (2) the weight 
associated with _each_ subexpression that was entered. (Getting the weight from 
the parser to the executor is in itself a journey it seems, as some expression 
types are created anew - and not copied - and lose their annotated weight over 
and over again.)

Furthermore I need the structure of OR to be preserved; the OR-of-OR structure 
from the last WHERE must be preserved or at least be  reconstructible and must 
not be folded into a 3-valued OR (as canonicalize_qual and friends do.)

To sum up, I am looking for a (decently efficient) scheme that is able to

(1) pass arbitrary conditional expressions from WHERE to the executor in a 
structure preserving way.
(2) annotate arbitrary expressions with weights that survive on its way from 
the parser to the executor.
(3) access the logical value of particular subexpressions.

I have some basic ideas how at least some of the requirements might be 
achieved. But as I am not totally satisfied with my ideas I hope you can 
provide me with some fresh input.

ANY ideas are welcome.

Regards,
Peter

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

                http://www.postgresql.org/about/donate


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to