You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by av...@apache.org on 2025/01/16 01:58:14 UTC
(cloudberry) 08/11: Move single row expression handler list-concat logic to parser. (#16015)
This is an automated email from the ASF dual-hosted git repository.
avamingli pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 24e71b856bba57556e9c4d0a15d6f541ffc03e42
Author: reshke <re...@double.cloud>
AuthorDate: Thu Jul 20 11:58:53 2023 +0500
Move single row expression handler list-concat logic to parser. (#16015)
This resolves GPDB_91_MERGE_FIXME in copy.c
Yacc parser rules modified so that SREH clause now return a list
of options, which is later concatenated with other copy stmt options.
Removed plain C code from copy.c which does exatly the same.
---
src/backend/commands/copy.c | 10 ----------
src/backend/parser/gram.y | 9 +++++++--
src/include/nodes/parsenodes.h | 2 +-
3 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index c0da428e53..f0942387f4 100644
--- a/src/backend/commands/copy.c
+++ b/src/backend/commands/copy.c
@@ -132,16 +132,6 @@ DoCopy(ParseState *pstate, const CopyStmt *stmt,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("COPY single row error handling only available using COPY FROM")));
- /* GPDB_91_MERGE_FIXME: this should probably be done earlier, e.g. in parser */
- /* Transfer any SREH options to the options list, so that BeginCopy can see them. */
- if (stmt->sreh)
- {
- SingleRowErrorDesc *sreh = (SingleRowErrorDesc *) stmt->sreh;
-
- options = list_copy(options);
- options = lappend(options, makeDefElem("sreh", (Node *) sreh, -1));
- }
-
lockmode = is_from ? RowExclusiveLock : AccessShareLock;
if (stmt->relation)
{
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 013f40bf59..b27e137517 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -326,7 +326,9 @@ static void check_expressions_in_partition_key(PartitionSpec *spec, core_yyscan_
CreateExternalStmt
CreateProfileStmt CreateQueueStmt CreateResourceGroupStmt CreateTagStmt
DropProfileStmt DropQueueStmt DropResourceGroupStmt DropTagStmt
- ExtTypedesc OptSingleRowErrorHandling ExtSingleRowErrorHandling
+ ExtTypedesc ExtSingleRowErrorHandling
+
+%type<list> OptSingleRowErrorHandling
%type <node> deny_login_role deny_interval deny_point deny_day_specifier
@@ -4783,6 +4785,9 @@ CopyStmt: COPY opt_binary qualified_name opt_column_list
n->options = lappend(n->options, $9);
if ($11)
n->options = list_concat(n->options, $11);
+ if ($13)
+ n->options = list_concat(n->options, $13);
+
$$ = (Node *)n;
}
| COPY '(' PreparableStmt ')' TO opt_program copy_file_name opt_with copy_options
@@ -7049,7 +7054,7 @@ OptSingleRowErrorHandling:
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid (ROWS) reject limit. Should be 2 or larger")));
- $$ = (Node *)n;
+ $$ = lappend(NULL, makeDefElem("sreh", (Node *) n, @1));
}
| /*EMPTY*/ { $$ = NULL; }
;
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index 7b5fb90849..948f3874b0 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -2435,7 +2435,7 @@ typedef struct CopyStmt
List *options; /* List of DefElem nodes */
Node *whereClause; /* WHERE condition (or NULL) */
- Node *sreh; /* Single row error handling info */
+ List *sreh; /* Single row error handling info */
} CopyStmt;
/* ----------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org