Re: [HACKERS] When(Where) does qual become a List ?
| От | Tom Lane |
|---|---|
| Тема | Re: [HACKERS] When(Where) does qual become a List ? |
| Дата | |
| Msg-id | 26063.931361303@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | When(Where) does qual become a List ? ("Hiroshi Inoue" <Inoue@tpf.co.jp>) |
| Список | pgsql-hackers |
"Hiroshi Inoue" <Inoue@tpf.co.jp> writes:
> I see the following defintion of query_planner() in
> optimizer/planner/planmain.c .
> Plan * query_planner(Query *root,
> int command_type,
> List *tlist,
> List *qual)
> Does this mean that qual is already a List when
> query_planner () is called ?
No, the declaration is a misnomer.
> But I see the following code in query_planner()
> qual = cnfify((Expr *) qual, true);
> Are Expr and List compatible ?
They're both pointers to "Node" objects, so the code works, ugly though
it is. It would probably be better to have both query_planner's qual
and cnfify's argument declared as "Node *", since they aren't
necessarily Expr nodes either (could be Var, Const, etc...)
Most of the planner/optimizer was once Lisp code, where there is only
one data type (effectively Node*), and the translation to C code was a
little sloppy about node types in many places. There are still a lot of
routines that declare their args to be of a specific type that really
isn't the only kind of node they might be handed.
BTW, I never much liked the fact that cnfify returns a list rather than
an explicit "AND" expression...
regards, tom lane
В списке pgsql-hackers по дате отправления: