From c1e43b25da1dc315b2f114beed7c3d20c5b08eab Mon Sep 17 00:00:00 2001 From: Marco Slot Date: Tue, 24 Sep 2019 11:26:47 +0200 Subject: [PATCH] Use the new create_distributed_function API in some call tests --- src/test/regress/expected/multi_mx_call.out | 8 +++----- src/test/regress/expected/multi_mx_call_0.out | 16 ++++------------ src/test/regress/sql/multi_mx_call.sql | 8 +++----- 3 files changed, 10 insertions(+), 22 deletions(-) diff --git a/src/test/regress/expected/multi_mx_call.out b/src/test/regress/expected/multi_mx_call.out index 4d4217bc4..027ba702a 100644 --- a/src/test/regress/expected/multi_mx_call.out +++ b/src/test/regress/expected/multi_mx_call.out @@ -255,7 +255,7 @@ END;$$; -- before distribution ... CALL multi_mx_call.mx_call_proc_tx(10); -- after distribution ... -select create_distributed_function('mx_call_proc_tx(int)'); +select create_distributed_function('mx_call_proc_tx(int)', '$1', 'mx_call_dist_table_1'); DEBUG: switching to sequential query execution mode DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands create_distributed_function @@ -263,7 +263,6 @@ DETAIL: A distributed function is created. To make sure subsequent commands see (1 row) -call multi_mx_call.colocate_proc_with_table('mx_call_proc_tx', 'mx_call_dist_table_1'::regclass, 0); CALL multi_mx_call.mx_call_proc_tx(20); DEBUG: pushing down the procedure ERROR: relation "mx_call_dist_table_1" does not exist @@ -287,7 +286,7 @@ BEGIN RAISE WARNING 'warning'; RAISE EXCEPTION 'error'; END;$$; -select create_distributed_function('mx_call_proc_raise(int)'); +select create_distributed_function('mx_call_proc_raise(int)', '$1', 'mx_call_dist_table_1'); DEBUG: switching to sequential query execution mode DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands create_distributed_function @@ -295,7 +294,6 @@ DETAIL: A distributed function is created. To make sure subsequent commands see (1 row) -call multi_mx_call.colocate_proc_with_table('mx_call_proc_raise', 'mx_call_dist_table_1'::regclass, 0); call multi_mx_call.mx_call_proc_raise(2); DEBUG: pushing down the procedure DEBUG: warning @@ -348,7 +346,7 @@ SET client_min_messages TO DEBUG1; -- CREATE FUNCTION mx_call_add(int, int) RETURNS int AS 'select $1 + $2;' LANGUAGE SQL IMMUTABLE; -SELECT create_distributed_function('mx_call_add(int,int)'); +SELECT create_distributed_function('mx_call_add(int,int)', '$1'); DEBUG: switching to sequential query execution mode DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands create_distributed_function diff --git a/src/test/regress/expected/multi_mx_call_0.out b/src/test/regress/expected/multi_mx_call_0.out index 6a8343d93..84f53a2c3 100644 --- a/src/test/regress/expected/multi_mx_call_0.out +++ b/src/test/regress/expected/multi_mx_call_0.out @@ -217,14 +217,10 @@ ERROR: syntax error at or near "CALL" LINE 1: CALL multi_mx_call.mx_call_proc_tx(10); ^ -- after distribution ... -select create_distributed_function('mx_call_proc_tx(int)'); +select create_distributed_function('mx_call_proc_tx(int)', '$1', 'mx_call_dist_table_1'); ERROR: function "mx_call_proc_tx(int)" does not exist -LINE 1: select create_distributed_function('mx_call_proc_tx(int)'); +LINE 1: select create_distributed_function('mx_call_proc_tx(int)', '... ^ -call multi_mx_call.colocate_proc_with_table('mx_call_proc_tx', 'mx_call_dist_table_1'::regclass, 0); -ERROR: syntax error at or near "call" -LINE 1: call multi_mx_call.colocate_proc_with_table('mx_call_proc_tx... - ^ CALL multi_mx_call.mx_call_proc_tx(20); ERROR: syntax error at or near "CALL" LINE 1: CALL multi_mx_call.mx_call_proc_tx(20); @@ -248,14 +244,10 @@ END;$$; ERROR: syntax error at or near "PROCEDURE" LINE 1: CREATE PROCEDURE mx_call_proc_raise(x int) LANGUAGE plpgsql ... ^ -select create_distributed_function('mx_call_proc_raise(int)'); +select create_distributed_function('mx_call_proc_raise(int)', '$1', 'mx_call_dist_table_1'); ERROR: function "mx_call_proc_raise(int)" does not exist LINE 1: select create_distributed_function('mx_call_proc_raise(int)'... ^ -call multi_mx_call.colocate_proc_with_table('mx_call_proc_raise', 'mx_call_dist_table_1'::regclass, 0); -ERROR: syntax error at or near "call" -LINE 1: call multi_mx_call.colocate_proc_with_table('mx_call_proc_ra... - ^ call multi_mx_call.mx_call_proc_raise(2); ERROR: syntax error at or near "call" LINE 1: call multi_mx_call.mx_call_proc_raise(2); @@ -296,7 +288,7 @@ SET client_min_messages TO DEBUG1; -- CREATE FUNCTION mx_call_add(int, int) RETURNS int AS 'select $1 + $2;' LANGUAGE SQL IMMUTABLE; -SELECT create_distributed_function('mx_call_add(int,int)'); +SELECT create_distributed_function('mx_call_add(int,int)', '$1'); DEBUG: switching to sequential query execution mode DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands create_distributed_function diff --git a/src/test/regress/sql/multi_mx_call.sql b/src/test/regress/sql/multi_mx_call.sql index d0c454977..c826d42d8 100644 --- a/src/test/regress/sql/multi_mx_call.sql +++ b/src/test/regress/sql/multi_mx_call.sql @@ -141,8 +141,7 @@ END;$$; -- before distribution ... CALL multi_mx_call.mx_call_proc_tx(10); -- after distribution ... -select create_distributed_function('mx_call_proc_tx(int)'); -call multi_mx_call.colocate_proc_with_table('mx_call_proc_tx', 'mx_call_dist_table_1'::regclass, 0); +select create_distributed_function('mx_call_proc_tx(int)', '$1', 'mx_call_dist_table_1'); CALL multi_mx_call.mx_call_proc_tx(20); SELECT id, val FROM mx_call_dist_table_1 ORDER BY id, val; @@ -152,8 +151,7 @@ BEGIN RAISE WARNING 'warning'; RAISE EXCEPTION 'error'; END;$$; -select create_distributed_function('mx_call_proc_raise(int)'); -call multi_mx_call.colocate_proc_with_table('mx_call_proc_raise', 'mx_call_dist_table_1'::regclass, 0); +select create_distributed_function('mx_call_proc_raise(int)', '$1', 'mx_call_dist_table_1'); call multi_mx_call.mx_call_proc_raise(2); @@ -171,7 +169,7 @@ SET client_min_messages TO DEBUG1; -- CREATE FUNCTION mx_call_add(int, int) RETURNS int AS 'select $1 + $2;' LANGUAGE SQL IMMUTABLE; -SELECT create_distributed_function('mx_call_add(int,int)'); +SELECT create_distributed_function('mx_call_add(int,int)', '$1'); -- non-const distribution parameters cannot be pushed down call multi_mx_call.mx_call_proc(2, mx_call_add(3, 4));