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 efdf9fac76d Fix errors on copy2
efdf9fac76d is described below
commit efdf9fac76d3c33b25c99b08c17cb83a31a206e4
Author: Jinbao Chen <[email protected]>
AuthorDate: Sat Nov 29 18:53:35 2025 +0800
Fix errors on copy2
---
src/backend/commands/copyfromparse.c | 13 ++++++++++---
src/test/regress/expected/copy2.out | 11 ++---------
src/test/regress/serial_schedule | 2 +-
src/test/regress/sql/copy2.sql | 7 -------
4 files changed, 13 insertions(+), 20 deletions(-)
diff --git a/src/backend/commands/copyfromparse.c
b/src/backend/commands/copyfromparse.c
index 9b6535c0eaf..90cf8c71981 100644
--- a/src/backend/commands/copyfromparse.c
+++ b/src/backend/commands/copyfromparse.c
@@ -1951,8 +1951,11 @@ CopyReadAttributesText(CopyFromState cstate, int
stop_processing_at_field)
strncmp(start_ptr, cstate->opts.default_print,
input_len) == 0)
{
/* fieldno is 0-indexed and attnum is 1-indexed */
- int m =
list_nth_int(cstate->attnumlist, fieldno) - 1;
-
+ int m;
+ if (cstate->dispatch_mode != COPY_EXECUTOR)
+ m = list_nth_int(cstate->attnumlist, fieldno) -
1;
+ else
+ m = list_nth_int(cstate->qe_attnumlist,
fieldno) -1;
if (cstate->defexprs[m] != NULL)
{
/* defaults contain entries for all physical
attributes */
@@ -2185,7 +2188,11 @@ endfield:
strncmp(start_ptr, cstate->opts.default_print,
input_len) == 0)
{
/* fieldno is 0-index and attnum is 1-index */
- int m =
list_nth_int(cstate->attnumlist, fieldno) - 1;
+ int m;
+ if (cstate->dispatch_mode != COPY_EXECUTOR)
+ m = list_nth_int(cstate->attnumlist, fieldno) -
1;
+ else
+ m = list_nth_int(cstate->qe_attnumlist,
fieldno) -1;
if (cstate->defexprs[m] != NULL)
{
diff --git a/src/test/regress/expected/copy2.out
b/src/test/regress/expected/copy2.out
index f91cad67b92..21fc65c0814 100644
--- a/src/test/regress/expected/copy2.out
+++ b/src/test/regress/expected/copy2.out
@@ -91,9 +91,9 @@ LINE 1: COPY x from stdin (encoding 'sql_ascii', encoding
'sql_ascii...
^
-- incorrect options
COPY x from stdin (format BINARY, delimiter ',');
-ERROR: cannot specify DELIMITER in BINARY mode
+ERROR: COPY cannot specify DELIMITER in BINARY mode
COPY x from stdin (format BINARY, null 'x');
-ERROR: cannot specify NULL in BINARY mode
+ERROR: COPY cannot specify NULL in BINARY mode
COPY x from stdin (format TEXT, force_quote(a));
ERROR: COPY force quote available only in CSV mode
COPY x from stdin (format CSV, force_quote(a));
@@ -601,7 +601,6 @@ DROP ROLE regress_rls_copy_user;
DROP ROLE regress_rls_copy_user_colperms;
DROP FUNCTION fn_x_before();
DROP FUNCTION fn_x_after();
-<<<<<<< HEAD
-- When error reject limit is set, copy should be able to continue after hit a
corrupted end-of-copy marker
CREATE TABLE copy_eoc_marker(a int, b int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a'
as the Apache Cloudberry data distribution key for this table.
@@ -615,11 +614,6 @@ SELECT * FROM copy_eoc_marker;
(1 row)
DROP TABLE copy_eoc_marker;
-=======
-DROP TABLE instead_of_insert_tbl;
-DROP VIEW instead_of_insert_tbl_view;
-DROP VIEW instead_of_insert_tbl_view_2;
-DROP FUNCTION fun_instead_of_insert_tbl();
--
-- COPY FROM ... DEFAULT
--
@@ -718,4 +712,3 @@ truncate copy_default;
-- DEFAULT cannot be used in COPY TO
copy (select 1 as test) TO stdout with (default '\D');
ERROR: COPY DEFAULT only available using COPY FROM
->>>>>>> REL_16_9
diff --git a/src/test/regress/serial_schedule b/src/test/regress/serial_schedule
index dde52b45cd8..7d232fa776b 100644
--- a/src/test/regress/serial_schedule
+++ b/src/test/regress/serial_schedule
@@ -175,7 +175,7 @@ test: jsonb_jsonpath
test: plancache
test: limit
test: plpgsql
-# test: copy2
+test: copy2
test: temp
test: domain
test: rangefuncs
diff --git a/src/test/regress/sql/copy2.sql b/src/test/regress/sql/copy2.sql
index 5cad8d890d1..997774123af 100644
--- a/src/test/regress/sql/copy2.sql
+++ b/src/test/regress/sql/copy2.sql
@@ -484,7 +484,6 @@ DROP ROLE regress_rls_copy_user;
DROP ROLE regress_rls_copy_user_colperms;
DROP FUNCTION fn_x_before();
DROP FUNCTION fn_x_after();
-<<<<<<< HEAD
-- When error reject limit is set, copy should be able to continue after hit a
corrupted end-of-copy marker
CREATE TABLE copy_eoc_marker(a int, b int);
@@ -494,11 +493,6 @@ COPY copy_eoc_marker FROM stdin LOG ERRORS SEGMENT REJECT
LIMIT 5;
\.
SELECT * FROM copy_eoc_marker;
DROP TABLE copy_eoc_marker;
-=======
-DROP TABLE instead_of_insert_tbl;
-DROP VIEW instead_of_insert_tbl_view;
-DROP VIEW instead_of_insert_tbl_view_2;
-DROP FUNCTION fun_instead_of_insert_tbl();
--
-- COPY FROM ... DEFAULT
@@ -600,4 +594,3 @@ truncate copy_default;
-- DEFAULT cannot be used in COPY TO
copy (select 1 as test) TO stdout with (default '\D');
->>>>>>> REL_16_9
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]