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
wasentered. (Getting the weight from the parser to the executor is in itself a journey it seems, as some expression
typesare 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
atleast 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
myideas I hope you can provide me with some fresh input.
ANY ideas are welcome.
Regards,
Peter