This is an automated email from the ASF dual-hosted git repository.
chenjinbao1989 pushed a commit to branch cbdb-postgres-merge
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
The following commit(s) were added to refs/heads/cbdb-postgres-merge by this
push:
new f1748a4d7e6 Fix merge error in copyto.c
f1748a4d7e6 is described below
commit f1748a4d7e6c638602cb87ce52f7ea29a94bcd0a
Author: Jinbao Chen <[email protected]>
AuthorDate: Thu Dec 18 02:25:23 2025 +0800
Fix merge error in copyto.c
---
src/backend/commands/cluster.c | 4 ----
src/backend/commands/copyto.c | 21 +++++++++++++++++++--
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index a2542bf4e22..e31fe4cef8e 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -527,10 +527,6 @@ cluster_rel(Oid tableOid, Oid indexOid, ClusterParams
*params)
goto out;
}
- Assert(OldHeap->rd_rel->relkind == RELKIND_RELATION ||
- OldHeap->rd_rel->relkind == RELKIND_MATVIEW ||
- OldHeap->rd_rel->relkind == RELKIND_TOASTVALUE);
-
/*
* All predicate locks on the tuples or pages are about to be made
* invalid, because we move tuples around. Promote them to relation
diff --git a/src/backend/commands/copyto.c b/src/backend/commands/copyto.c
index 292d464ab93..408f98f6ff9 100644
--- a/src/backend/commands/copyto.c
+++ b/src/backend/commands/copyto.c
@@ -200,7 +200,18 @@ void CopySendEndOfRow(CopyToState cstate)
(void) pq_putmessage('d', fe_msgbuf->data,
fe_msgbuf->len);
break;
case COPY_CALLBACK:
- cstate->data_dest_cb(fe_msgbuf->data, fe_msgbuf->len);
+ if (cstate->data_dest_cb)
+ cstate->data_dest_cb(fe_msgbuf->data,
fe_msgbuf->len);
+ else
+ {
+ /* we don't actually do the write here, we let
the caller do it */
+#ifndef WIN32
+ CopySendChar(cstate, '\n');
+#else
+ CopySendString(cstate, "\r\n");
+#endif
+ return; /* don't want to reset msgbuf quite yet
*/
+ }
break;
}
@@ -338,6 +349,12 @@ BeginCopyTo(ParseState *pstate,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("STDOUT is not supported by
'COPY ON SEGMENT'")));
}
+ else if (data_dest_cb)
+ {
+ progress_vals[1] = PROGRESS_COPY_TYPE_CALLBACK;
+ cstate->copy_dest = COPY_CALLBACK;
+ cstate->data_dest_cb = data_dest_cb;
+ }
else if (pipe)
{
progress_vals[1] = PROGRESS_COPY_TYPE_PIPE;
@@ -466,7 +483,7 @@ EndCopyTo(CopyToState cstate, uint64 *processed)
uint64
DoCopyTo(CopyToState cstate)
{
- bool pipe = (cstate->filename == NULL);
+ bool pipe = (cstate->filename == NULL &&
cstate->data_dest_cb == NULL);
bool fe_copy = (pipe && whereToSendOutput == DestRemote);
uint64 processed;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]