Re: COPY planning

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: COPY planning
Date: 2015-09-28 18:22:34
Message-ID: 20150928182234.GU295765@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Stephen Frost wrote:
> * Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us) wrote:
> > Alvaro Herrera <alvherre(at)2ndquadrant(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-09-28 18:29:38 Re: COPY planning
Previous Message Robert Haas 2015-09-28 18:09:33 Re: track_commit_timestamp and COMMIT PREPARED