This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
The following commit(s) were added to refs/heads/main by this push:
new 430c5b6e849 Fix: fix external table check and report errors
430c5b6e849 is described below
commit 430c5b6e849eb01bc336f933c1ccdf6daf604794
Author: liushengsong <[email protected]>
AuthorDate: Thu Nov 20 10:17:32 2025 +0800
Fix: fix external table check and report errors
For external table with type CFTYPE_EXEC, we check and report errors
after end of external_getnext. So that we can detect and report errors
promptly, preventing errors from being missed due to the execution
node being squelched.
---
gpcontrib/gp_exttable_fdw/extaccess.c | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/gpcontrib/gp_exttable_fdw/extaccess.c
b/gpcontrib/gp_exttable_fdw/extaccess.c
index f52e4c50052..c115d3583e1 100644
--- a/gpcontrib/gp_exttable_fdw/extaccess.c
+++ b/gpcontrib/gp_exttable_fdw/extaccess.c
@@ -491,25 +491,20 @@ external_getnext_init(PlanState *state)
return desc;
}
+/*
+ * check_exec_error
+ *
+ * check CFTYPE_EXEC error after external_getnext.
+ */
static void
-check_error(FileScanDesc scan)
+check_exec_error(FileScanDesc scan)
{
char *relname = RelationGetRelationName(scan->fs_rd);
- int ebuflen = 512;
- char ebuf[512];
-
- ebuf[0] = '\0';
- /* current only CFTYPE_EXEC will read stderr to ebuf */
- if (url_ferror(scan->fs_file, -1, ebuf, ebuflen))
+ if (scan->fs_file->type == CFTYPE_EXEC)
{
- if (*ebuf && strlen(ebuf) > 0)
- ereport(ERROR,
-
(errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
- errmsg("external table %s command
ended with error. %s",
- (relname ? relname :
""), ebuf),
- errdetail("Command: %s",
scan->fs_file->url)));
+ url_fclose(scan->fs_file, !QueryFinishPending, relname);
+ scan->fs_file = NULL;
}
-
}
/* ----------------------------------------------------------------
@@ -551,7 +546,7 @@ external_getnext(FileScanDesc scan, ScanDirection
direction, ExternalSelectDesc
{
FILEDEBUG_2; /* external_getnext returning
EOS */
- check_error(scan);
+ check_exec_error(scan);
return NULL;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]