Use the new create_distributed_function API in some call tests

pull/3026/head
Marco Slot 2019-09-24 11:26:47 +02:00 committed by Philip Dubé
parent ca478defeb
commit c1e43b25da
3 changed files with 10 additions and 22 deletions

View File

@ -255,7 +255,7 @@ END;$$;
-- before distribution ... -- before distribution ...
CALL multi_mx_call.mx_call_proc_tx(10); CALL multi_mx_call.mx_call_proc_tx(10);
-- after distribution ... -- 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 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 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 create_distributed_function
@ -263,7 +263,6 @@ DETAIL: A distributed function is created. To make sure subsequent commands see
(1 row) (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); CALL multi_mx_call.mx_call_proc_tx(20);
DEBUG: pushing down the procedure DEBUG: pushing down the procedure
ERROR: relation "mx_call_dist_table_1" does not exist ERROR: relation "mx_call_dist_table_1" does not exist
@ -287,7 +286,7 @@ BEGIN
RAISE WARNING 'warning'; RAISE WARNING 'warning';
RAISE EXCEPTION 'error'; RAISE EXCEPTION 'error';
END;$$; 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 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 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 create_distributed_function
@ -295,7 +294,6 @@ DETAIL: A distributed function is created. To make sure subsequent commands see
(1 row) (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); call multi_mx_call.mx_call_proc_raise(2);
DEBUG: pushing down the procedure DEBUG: pushing down the procedure
DEBUG: warning DEBUG: warning
@ -348,7 +346,7 @@ SET client_min_messages TO DEBUG1;
-- --
CREATE FUNCTION mx_call_add(int, int) RETURNS int CREATE FUNCTION mx_call_add(int, int) RETURNS int
AS 'select $1 + $2;' LANGUAGE SQL IMMUTABLE; 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 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 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 create_distributed_function

View File

@ -217,13 +217,9 @@ ERROR: syntax error at or near "CALL"
LINE 1: CALL multi_mx_call.mx_call_proc_tx(10); LINE 1: CALL multi_mx_call.mx_call_proc_tx(10);
^ ^
-- after distribution ... -- 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 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); CALL multi_mx_call.mx_call_proc_tx(20);
ERROR: syntax error at or near "CALL" ERROR: syntax error at or near "CALL"
@ -248,14 +244,10 @@ END;$$;
ERROR: syntax error at or near "PROCEDURE" ERROR: syntax error at or near "PROCEDURE"
LINE 1: CREATE PROCEDURE mx_call_proc_raise(x int) LANGUAGE plpgsql ... 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 ERROR: function "mx_call_proc_raise(int)" does not exist
LINE 1: select create_distributed_function('mx_call_proc_raise(int)'... 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); call multi_mx_call.mx_call_proc_raise(2);
ERROR: syntax error at or near "call" ERROR: syntax error at or near "call"
LINE 1: call multi_mx_call.mx_call_proc_raise(2); 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 CREATE FUNCTION mx_call_add(int, int) RETURNS int
AS 'select $1 + $2;' LANGUAGE SQL IMMUTABLE; 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 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 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 create_distributed_function

View File

@ -141,8 +141,7 @@ END;$$;
-- before distribution ... -- before distribution ...
CALL multi_mx_call.mx_call_proc_tx(10); CALL multi_mx_call.mx_call_proc_tx(10);
-- after distribution ... -- 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');
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); CALL multi_mx_call.mx_call_proc_tx(20);
SELECT id, val FROM mx_call_dist_table_1 ORDER BY id, val; SELECT id, val FROM mx_call_dist_table_1 ORDER BY id, val;
@ -152,8 +151,7 @@ BEGIN
RAISE WARNING 'warning'; RAISE WARNING 'warning';
RAISE EXCEPTION 'error'; RAISE EXCEPTION 'error';
END;$$; 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');
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); 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 CREATE FUNCTION mx_call_add(int, int) RETURNS int
AS 'select $1 + $2;' LANGUAGE SQL IMMUTABLE; 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 -- non-const distribution parameters cannot be pushed down
call multi_mx_call.mx_call_proc(2, mx_call_add(3, 4)); call multi_mx_call.mx_call_proc(2, mx_call_add(3, 4));