Re: A modest proposal: make parser/rewriter/planner inputs read-only - Mailing list pgsql-hackers

From Tom Lane
Subject Re: A modest proposal: make parser/rewriter/planner inputs read-only
Date
Msg-id 1915837.1744820562@sss.pgh.pa.us
Whole thread Raw
In response to Re: A modest proposal: make parser/rewriter/planner inputs read-only  (Andrei Lepikhov <lepihov@gmail.com>)
Responses Re: A modest proposal: make parser/rewriter/planner inputs read-only
List pgsql-hackers
Andrei Lepikhov <lepihov@gmail.com> writes:
> I just want to understand how your idea will work. The query_planner 
> does the job for subqueries separately. If a query is transformed in 
> some way (let's say, an unnecessary join is deleted), we need to change 
> references in the parse tree of another subquery, or it will not find 
> the reference at the moment of planning, right?

Don't see why.  If we're separately planning a subquery, we would
not dare to change anything about its outputs, just as we would
not make a change that affects the topmost level's outputs.  I don't
believe there's anything right now that requires a recursive
subquery_planner call to change the outer parsetree, and this idea
wouldn't affect that.

Now, subquery_planner does have side effects on the PlannerGlobal
struct, but that's planner-local data, not an input to the planner.

Maybe we would like to have some enforced contract about what
subquery_planner can and can't touch in the outer planner level's
data, but I'm not feeling a great need for that right now.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Add Pipelining support in psql
Next
From: Michael Paquier
Date:
Subject: Re: pipelining in psql, commit 41625ab