From 205f48f43229f65ef226615a2f48dd1db56dcad9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Fri, 18 Oct 2019 20:42:47 +0000 Subject: [PATCH] Add input validation testing for mark_aggregate_for_distributed_execution --- src/test/regress/expected/distributed_functions.out | 7 +++++++ src/test/regress/sql/distributed_functions.sql | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/test/regress/expected/distributed_functions.out b/src/test/regress/expected/distributed_functions.out index 803470f58..3465f1d32 100644 --- a/src/test/regress/expected/distributed_functions.out +++ b/src/test/regress/expected/distributed_functions.out @@ -392,6 +392,13 @@ FROM colocation_table ct JOIN cojoin_table jt ON ct.id = jt.id GROUP BY ct.val ORDER BY ct.val; ERROR: unsupported aggregate function sum2 +-- First test 3 erroneous inputs +SELECT mark_aggregate_for_distributed_execution(NULL, 'none'); +ERROR: the first parameter for mark_aggregate_for_distributed_execution() should be a single a valid function or procedure name followed by a list of parameters in parantheses +SELECT mark_aggregate_for_distributed_execution('function_tests2.sum2(int)', NULL); +ERROR: mark_aggregate_for_distributed_execution expects a strategy that is one of: 'none', 'combine', 'commute' +SELECT mark_aggregate_for_distributed_execution('function_tests2.sum2(int)', 'asdf'); +ERROR: mark_aggregate_for_distributed_execution expects a strategy that is one of: 'none', 'combine', 'commute' SELECT mark_aggregate_for_distributed_execution('function_tests2.sum2(int)', 'combine'); mark_aggregate_for_distributed_execution ------------------------------------------ diff --git a/src/test/regress/sql/distributed_functions.sql b/src/test/regress/sql/distributed_functions.sql index a7162baf3..be2ed7cde 100644 --- a/src/test/regress/sql/distributed_functions.sql +++ b/src/test/regress/sql/distributed_functions.sql @@ -237,6 +237,10 @@ FROM colocation_table ct JOIN cojoin_table jt ON ct.id = jt.id GROUP BY ct.val ORDER BY ct.val; +-- First test 3 erroneous inputs +SELECT mark_aggregate_for_distributed_execution(NULL, 'none'); +SELECT mark_aggregate_for_distributed_execution('function_tests2.sum2(int)', NULL); +SELECT mark_aggregate_for_distributed_execution('function_tests2.sum2(int)', 'asdf'); SELECT mark_aggregate_for_distributed_execution('function_tests2.sum2(int)', 'combine'); SELECT ct.val, function_tests2.sum2(ct.id + jt.val) FROM colocation_table ct @@ -288,7 +292,6 @@ SELECT create_distributed_function('add_with_param_names(int, int)', '$-1'); SELECT create_distributed_function('add_with_param_names(int, int)', '$-10'); SELECT create_distributed_function('add_with_param_names(int, int)', '$3'); SELECT create_distributed_function('add_with_param_names(int, int)', '$1a'); - -- non existing column name SELECT create_distributed_function('add_with_param_names(int, int)', 'aaa');