Expression Evaluator used for creating the plan tree / stmt ?

From: Vaibhav Kaushal <vaibhavkaushal123(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Expression Evaluator used for creating the plan tree / stmt ?
Date: 2011-05-25 09:52:32
Message-ID: BANLkTi=He2KG2tZ=_pS9E1wSZ-rt_Cn7Sg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Query:
=====
I am aware of the fact that Expression evaluator is used to filter tuples
based on the qual. However, I think it is not the only purpose it serves. As
I manipulated the ExecEvalVar in the executor, the queries started behaving
abnormally (the comparison operators < , <>, > lost effect and at times
started working ). Is the creation of qual also done (in part?) by the
expression evaluator? If yes, what part of query creation process is handled
by the evaluator? I know ExecInitExpr does expr -> exprstate tree creation,
but it is not the evaluator.

If the above is confusing, I just want to ask: "Is expression evaluator,
even in part responsible for {PLANNEDSTMT creation?"
--------------------------------------------------------

My work / trial so far:
===============
I see that the target list to be scanned is handled by "ExecTargetList"
function.

I am not so sure about this because this function is not listed in the list
of functions which GDB shows me (./configure --enable-debug && make clean &&
make && make install). Rest everything else (almost / perhaps) is shown!
(Can anyone tell why? :( )

Whatever be the case, I think the target list creation will somehow call
ExecEvalVar because:

1. It is this function whose modification gets me the erroneous behavior.
2. Server, when run in debug 4 / 5 mode shows target entries as VARs.
3. VARs are range table representation in some form and ExecEvalVar makes
sense to create the target entry.
---------------------------------------------------

What changes caused this:
===================

I inserted this line into ExecEvalVar as well as ExecEvalScalarVar:

return cute_datum_array[attnum];

before:

return slot_getattr(slot, attnum, isNull);

It was just an experiment to see how things are getting done. I know most
devs here would suggest GDB but I am already using that and I did this to
check possible effects than trace.

-----------------------------------------------------

I seriously think the target list would involve VARs whose one-time
evaluation is done. Since cute_datum_array was a garbage array
(intentional), it would crash! Am I right?

Regards,
Vaibhav

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavan Deolasee 2011-05-25 10:02:46 Re: Expression Evaluator used for creating the plan tree / stmt ?
Previous Message Emanuel Calvo 2011-05-25 09:28:42 pg_basebackup