Re: COPY planning - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: COPY planning
Date
Msg-id 20150928182234.GU295765@alvherre.pgsql
Whole thread Raw
In response to Re: COPY planning  (Stephen Frost <sfrost@snowman.net>)
Responses Re: COPY planning
List pgsql-hackers
Stephen Frost wrote:
> * Tom Lane (tgl@sss.pgh.pa.us) wrote:
> > Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> > > I noticed that COPY calls planner() (this was introduced in 85188ab88).
> > > I think it should be calling pg_plan_query() instead.
> > 
> > +1 --- AFAICS, this is the *only* place that is going directly to
> > planner() without going through pg_plan_query(); other utility
> > functions such as CREATE TABLE AS do the latter.

Yeah, exactly.  Thus, pushed.

> > As far as the patch goes, do copy.c's #include's need adjustment?
> > I'm wondering if optimizer/planner.h could be removed, in particular.
> 
> BeginCopyFrom still uses expression_planner(), at least..

Yup.  However I notice that there are a few other callers of
expression_planner() that do not involve the optimizer for anything
else.  Maybe it makes sense to have a separate header file that's just

#include "nodes/primnodes.h"
extern Expr *expression_planner(Expr *expr);
extern bool plan_cluster_use_sort(Oid tableOid, Oid indexOid);

Seems it could be used by a large percentage of files currently
including planner.h.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: track_commit_timestamp and COMMIT PREPARED
Next
From: Tom Lane
Date:
Subject: Re: COPY planning