diff --git a/src/common/backend/nodes/outfuncs.cpp b/src/common/backend/nodes/outfuncs.cpp index 71f1c39d9..ca10178dd 100755 --- a/src/common/backend/nodes/outfuncs.cpp +++ b/src/common/backend/nodes/outfuncs.cpp @@ -579,7 +579,8 @@ static void _outPlannedStmt(StringInfo str, PlannedStmt* node) WRITE_INT_FIELD(gather_count); WRITE_INT_FIELD(num_nodes); - if (t_thrd.proc->workingVersionNum < 92097 || node->num_streams > 0 || IS_SPQ_RUNNING) { + if ((t_thrd.proc->workingVersionNum < 92097 || node->num_streams > 0 || IS_SPQ_RUNNING) && + node->nodesDefinition != NULL) { for (int i = 0; i < node->num_nodes; i++) { /* Write the field name only one time and just append the value of each field */ appendStringInfo(str, " :nodesDefinition[%d]", i); diff --git a/src/test/regress/expected/outfuncs_bugfix.out b/src/test/regress/expected/outfuncs_bugfix.out new file mode 100644 index 000000000..a96b71851 --- /dev/null +++ b/src/test/regress/expected/outfuncs_bugfix.out @@ -0,0 +1,20 @@ +set log_min_messages = debug5; +set log_min_error_statement = debug5; +alter system set debug_print_rewritten = on; +alter system set debug_print_plan = on; +drop table t1; +ERROR: table "t1" does not exist +create table t1(col1 int, col2 varchar(20)); +insert into t1 values (1,'tom'), (2,'daisy'), (3,'john'); +set query_dop=1004; +select * from t1 limit 1; + col1 | col2 +------+------ + 1 | tom +(1 row) + +drop table t1; +reset log_min_messages ; +reset log_min_error_statement ; +alter system set debug_print_rewritten = off; +alter system set debug_print_plan = off; diff --git a/src/test/regress/parallel_schedule0A b/src/test/regress/parallel_schedule0A index 21d790c0b..f1016f37b 100644 --- a/src/test/regress/parallel_schedule0A +++ b/src/test/regress/parallel_schedule0A @@ -126,6 +126,7 @@ test: single_node_tablespace #test startwith...connect by test: sw_prepare test: sw_basic sw_icbc sw_siblings sw_bugfix-1 sw_bugfix-2 sw_by_rownum_level sw_prior +test: outfuncs_bugfix test: sw_clearup # test customer base environment hint diff --git a/src/test/regress/sql/outfuncs_bugfix.sql b/src/test/regress/sql/outfuncs_bugfix.sql new file mode 100644 index 000000000..73d156dcd --- /dev/null +++ b/src/test/regress/sql/outfuncs_bugfix.sql @@ -0,0 +1,17 @@ +set log_min_messages = debug5; +set log_min_error_statement = debug5; +alter system set debug_print_rewritten = on; +alter system set debug_print_plan = on; + +drop table t1; +create table t1(col1 int, col2 varchar(20)); +insert into t1 values (1,'tom'), (2,'daisy'), (3,'john'); +set query_dop=1004; +select * from t1 limit 1; +drop table t1; + + +reset log_min_messages ; +reset log_min_error_statement ; +alter system set debug_print_rewritten = off; +alter system set debug_print_plan = off; \ No newline at end of file