I noticed that COPY calls planner() (this was introduced in 85188ab88).
I think it should be calling pg_plan_query() instead.  The latter is a
very thin wrapper around the former which simply adds a couple of
logging entries, DTrace hooks for start/end, and a debugging cross-check
for plan node copying.

I came across this because I was considering adding some code to
pg_plan_query, so I would have needed to essentially duplicate it in the
COPY path, which seemed bad.  (I have since abandoned the idea, but this
seems a reasonable thing to change nonetheless.)


diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index e98f0fe..94b2f8f 100644
--- a/src/backend/commands/copy.c
+++ b/src/backend/commands/copy.c
@@ -1414,7 +1414,7 @@ BeginCopy(bool is_from,
                Assert(query->utilityStmt == NULL);
 
                /* plan the query */
-               plan = planner(query, 0, NULL);
+               plan = pg_plan_query(query, 0, NULL);
 
                /*
                 * With row level security and a user using "COPY relation TO", 
we

-- 
Álvaro Herrera                            33.5S 70.5W


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to