Re: [HACKERS] When(Where) does qual become a List ?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp>
Cc: "pgsql-hackers" <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] When(Where) does qual become a List ?
Date: 1999-07-07 15:28:23
Message-ID: 26063.931361303@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)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

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael J Schout 1999-07-07 15:29:36 Re: [HACKERS] Re: Postgresql 6.5-1 rpms on RedHat 6.0
Previous Message Vince Vielhaber 1999-07-07 15:28:18 History?