From: Tomas Vondra Date: Sun, 30 Jul 2017 15:27:36 +0000 (+0200) Subject: Produce proper error message for COPY (SELECT INTO) X-Git-Tag: XL_10_R1BETA1~188 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=a60df4b535c3f2be055ea44a627ac86ead57ef04;p=postgres-xl.git Produce proper error message for COPY (SELECT INTO) Produce the right error message for COPY (SELECT INTO) queries, that is ERROR: COPY (SELECT INTO) is not supported instead of the incorrect ERROR: COPY query must have a RETURNING clause The root cause is that the check in BeginCopy() was testing raw_query, but XL wraps the original command in RawStmt, so we should be checking raw_query->stmt instead. --- diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index 37d9a898cf..a5122e61f6 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -1567,9 +1567,9 @@ BeginCopy(ParseState *pstate, * will ultimately lead to an error, but doing it here allows us to * throw a more friendly and PG-compatible error. */ - if (IsA(raw_query, SelectStmt)) + if (IsA(raw_query->stmt, SelectStmt)) { - SelectStmt *stmt = (SelectStmt *) raw_query; + SelectStmt *stmt = (SelectStmt *) raw_query->stmt; /* * If it's a set-operation tree, drilldown to leftmost SelectStmt