提交 139a065d 编写于 作者: J Jesse Zhang

remove command-not-found tests for COPY

After commit 2b51c16b Greenplum diverged
from the upstream behavior of using `popen`, and instead captures the
stderr of the COPY PROGRAM and prints that out in case of error (read:
non-zero return status).

This means that we no longer specially handle the case of return status
127 and use `wait_result_to_str` to tell the user "command not found".
Instead, we output whatever is in the stderr of the standard shell
/bin/sh.

That means a command-not-found is completely indistinguishable from the
case where the program invoked returning non-zero status and printing
something into its stderr. Moreover, the output of command-not-found is
not portable, and not really controlled by Greenplum/Postgres.

We already have coverage for cases involving returning stderr from
segments and master to the user, and the command not found cases are not
only redundant coverage, they are also brittle.

This commit removes the test cases for command-not-found and updates the
expected test output.
上级 c1cac08c
......@@ -1047,16 +1047,11 @@ DROP TABLE IF EXISTS COPY_TO_PROGRAM_ERROR;
DROP TABLE IF EXISTS COPY_FROM_PROGRAM_ERROR;
-- end_ignore
CREATE TABLE COPY_TO_PROGRAM_ERROR(dir text);
COPY COPY_TO_PROGRAM_ERROR TO PROGRAM 'ttt';
\COPY COPY_TO_PROGRAM_ERROR TO PROGRAM 'ttt';
COPY COPY_TO_PROGRAM_ERROR TO PROGRAM 'ttt <SEGID>' ON SEGMENT;
COPY COPY_TO_PROGRAM_ERROR TO PROGRAM 'echo && echo "error" >&2 && exit -1';
COPY COPY_TO_PROGRAM_ERROR TO PROGRAM 'echo <SEGID>&& echo "error" >&2 && exit -1' on segment;
CREATE TABLE COPY_FROM_PROGRAM_ERROR(a int);
COPY COPY_FROM_PROGRAM_ERROR FROM PROGRAM 'ttt';
COPY COPY_FROM_PROGRAM_ERROR FROM PROGRAM 'ttt <SEGID>' ON SEGMENT;
COPY COPY_FROM_PROGRAM_ERROR FROM PROGRAM 'echo 1; echo "error" >&2 && exit -1';
SELECT COUNT(*) FROM COPY_FROM_PROGRAM_ERROR;
......
......@@ -1203,13 +1203,6 @@ DROP TABLE IF EXISTS COPY_FROM_PROGRAM_ERROR;
CREATE TABLE COPY_TO_PROGRAM_ERROR(dir text);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'dir' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
COPY COPY_TO_PROGRAM_ERROR TO PROGRAM 'ttt';
ERROR: command error message: sh: ttt: command not found
\COPY COPY_TO_PROGRAM_ERROR TO PROGRAM 'ttt';
sh: ttt: command not found
ttt: command not found
COPY COPY_TO_PROGRAM_ERROR TO PROGRAM 'ttt <SEGID>' ON SEGMENT;
ERROR: Error from segment 0: ERROR: command error message: sh: ttt: command not found
COPY COPY_TO_PROGRAM_ERROR TO PROGRAM 'echo && echo "error" >&2 && exit -1';
ERROR: command error message: error
COPY COPY_TO_PROGRAM_ERROR TO PROGRAM 'echo <SEGID>&& echo "error" >&2 && exit -1' on segment;
......@@ -1217,11 +1210,6 @@ ERROR: Error from segment 0: ERROR: command error message: error
CREATE TABLE COPY_FROM_PROGRAM_ERROR(a int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
COPY COPY_FROM_PROGRAM_ERROR FROM PROGRAM 'ttt';
ERROR: command error message: sh: ttt: command not found
COPY COPY_FROM_PROGRAM_ERROR FROM PROGRAM 'ttt <SEGID>' ON SEGMENT;
ERROR: command error message: sh: ttt: command not found
CONTEXT: COPY copy_from_program_error, line 0: ""
COPY COPY_FROM_PROGRAM_ERROR FROM PROGRAM 'echo 1; echo "error" >&2 && exit -1';
ERROR: command error message: error
SELECT COUNT(*) FROM COPY_FROM_PROGRAM_ERROR;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册