diff --git a/src/test/regress/expected/master_evaluation_modify.out b/src/test/regress/expected/master_evaluation_modify.out index 729e39ddf..a8123b94c 100644 --- a/src/test/regress/expected/master_evaluation_modify.out +++ b/src/test/regress/expected/master_evaluation_modify.out @@ -35,7 +35,7 @@ END; $$ language plpgsql STABLE; CREATE TYPE user_data AS (name text, age int); SET citus.replication_model TO streaming; SET citus.shard_replication_factor TO 1; -CREATE TABLE user_info_data (user_id int, u_data user_data); +CREATE TABLE user_info_data (user_id int, u_data user_data, user_index int); SELECT create_distributed_table('user_info_data', 'user_id'); create_distributed_table --------------------------------------------------------------------- @@ -49,9 +49,9 @@ SELECT get_local_node_id_stable(); 0 (1 row) -INSERT INTO user_info_data SELECT i, ('name' || i, i % 20 + 20)::user_data FROM generate_series(0,7)i; +INSERT INTO user_info_data SELECT i, ('name' || i, i % 20 + 20)::user_data, i FROM generate_series(0,7)i; -- make sure that it is also true for fast-path router queries with paramaters -PREPARE fast_path_router_with_param(int) AS DELETE FROM user_info_data WHERE user_id = $1 RETURNING *; +PREPARE fast_path_router_with_param(int) AS DELETE FROM user_info_data WHERE user_id = $1 RETURNING user_id, u_data; execute fast_path_router_with_param(0); user_id | u_data --------------------------------------------------------------------- @@ -101,7 +101,7 @@ execute fast_path_router_with_param(7); (1 row) -- make sure that it is also true for fast-path router queries with paramaters -PREPARE fast_path_router_with_param_and_func(int) AS DELETE FROM user_info_data WHERE u_data = ('test', get_local_node_id_stable())::user_data AND user_id = $1 RETURNING *; +PREPARE fast_path_router_with_param_and_func(int) AS DELETE FROM user_info_data WHERE u_data = ('test', get_local_node_id_stable())::user_data AND user_id = $1 RETURNING user_id, u_data; INSERT INTO user_info_data SELECT i, ('test', 0)::user_data FROM generate_series(0,7)i; -- should evaluate the function on the coordinator, hence get_local_node_id_stable() returns zero execute fast_path_router_with_param_and_func(0); @@ -152,8 +152,59 @@ execute fast_path_router_with_param_and_func(7); 7 | (test,0) (1 row) +INSERT INTO user_info_data SELECT 1, ('test', 0)::user_data, i FROM generate_series(0,7)i; +PREPARE fast_path_router_with_param_and_func_on_non_dist_key(int) AS + DELETE FROM user_info_data WHERE user_id = 1 AND user_index = $1 AND u_data = ('test', get_local_node_id_stable())::user_data RETURNING *; +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(0); + user_id | u_data | user_index +--------------------------------------------------------------------- + 1 | (test,0) | 0 +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(1); + user_id | u_data | user_index +--------------------------------------------------------------------- + 1 | (test,0) | 1 +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(2); + user_id | u_data | user_index +--------------------------------------------------------------------- + 1 | (test,0) | 2 +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(3); + user_id | u_data | user_index +--------------------------------------------------------------------- + 1 | (test,0) | 3 +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(4); + user_id | u_data | user_index +--------------------------------------------------------------------- + 1 | (test,0) | 4 +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(5); + user_id | u_data | user_index +--------------------------------------------------------------------- + 1 | (test,0) | 5 +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(6); + user_id | u_data | user_index +--------------------------------------------------------------------- + 1 | (test,0) | 6 +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(7); + user_id | u_data | user_index +--------------------------------------------------------------------- + 1 | (test,0) | 7 +(1 row) + INSERT INTO user_info_data SELECT 1, ('test' || i, 0)::user_data FROM generate_series(0,7)i; -PREPARE fast_path_router_with_param_on_non_dist_key_and_func(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 1 RETURNING *; +PREPARE fast_path_router_with_param_on_non_dist_key_and_func(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 1 RETURNING user_id, u_data; EXECUTE fast_path_router_with_param_on_non_dist_key_and_func(('test0', get_local_node_id_stable())::user_data); user_id | u_data --------------------------------------------------------------------- @@ -204,7 +255,7 @@ EXECUTE fast_path_router_with_param_on_non_dist_key_and_func(('test7', get_local INSERT INTO user_info_data SELECT 1, ('test', i)::user_data FROM generate_series(0,7)i; PREPARE fast_path_router_with_param_on_non_dist_key(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 1 RETURNING - *; + user_id, u_data; EXECUTE fast_path_router_with_param_on_non_dist_key(('test', 0)::user_data); user_id | u_data --------------------------------------------------------------------- @@ -255,7 +306,7 @@ EXECUTE fast_path_router_with_param_on_non_dist_key(('test', 7)::user_data); INSERT INTO user_info_data SELECT i, ('test', i)::user_data FROM generate_series(0,7)i; PREPARE fast_path_router_with_two_params(user_data, int) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = $2 RETURNING - *; + user_id, u_data; EXECUTE fast_path_router_with_two_params(('test', 0)::user_data, 0); user_id | u_data --------------------------------------------------------------------- @@ -305,7 +356,7 @@ EXECUTE fast_path_router_with_two_params(('test', 7)::user_data, 7); (1 row) INSERT INTO user_info_data VALUES(1, ('test', 1)::user_data); -PREPARE fast_path_router_with_only_function AS DELETE FROM user_info_data WHERE get_local_node_id_stable() = 0 AND user_id = 1 RETURNING *; +PREPARE fast_path_router_with_only_function AS DELETE FROM user_info_data WHERE get_local_node_id_stable() = 0 AND user_id = 1 RETURNING user_id, u_data; EXECUTE fast_path_router_with_only_function; user_id | u_data --------------------------------------------------------------------- @@ -361,7 +412,6 @@ EXECUTE fast_path_router_with_only_function; 1 | (test,1) (1 row) -ALTER TABLE user_info_data ADD COLUMN user_index INT; PREPARE insert_with_function_and_param(user_data) AS INSERT INTO user_info_data VALUES (1, $1, get_local_node_id_stable()) RETURNING user_id; EXECUTE insert_with_function_and_param(('test', 1)::user_data); user_id @@ -405,11 +455,10 @@ EXECUTE insert_with_function_and_param(('test', 1)::user_data); 1 (1 row) -ALTER TABLE user_info_data DROP COLUMN user_index; TRUNCATE user_info_data; INSERT INTO user_info_data SELECT i, ('test', i)::user_data FROM generate_series(0,7)i; -- make sure that it is also true for non fast-path router queries with paramaters -PREPARE router_with_param(int) AS DELETE FROM user_info_data WHERE user_id = $1 AND user_id = $1 RETURNING *; +PREPARE router_with_param(int) AS DELETE FROM user_info_data WHERE user_id = $1 AND user_id = $1 RETURNING user_id, u_data; execute router_with_param(0); user_id | u_data --------------------------------------------------------------------- @@ -459,7 +508,7 @@ execute router_with_param(7); (1 row) -- make sure that it is also true for non fast-path router queries with paramaters -PREPARE router_with_param_and_func(int) AS DELETE FROM user_info_data WHERE u_data = ('test', get_local_node_id_stable())::user_data AND user_id = $1 AND user_id = $1 RETURNING *; +PREPARE router_with_param_and_func(int) AS DELETE FROM user_info_data WHERE u_data = ('test', get_local_node_id_stable())::user_data AND user_id = $1 AND user_id = $1 RETURNING user_id, u_data; INSERT INTO user_info_data SELECT i, ('test', 0)::user_data FROM generate_series(0,7)i; execute router_with_param_and_func(0); user_id | u_data @@ -509,8 +558,59 @@ execute router_with_param_and_func(7); 7 | (test,0) (1 row) +INSERT INTO user_info_data SELECT 1, ('test', 0)::user_data, i FROM generate_series(0,7)i; +PREPARE router_with_param_and_func_on_non_dist_key(int) AS + DELETE FROM user_info_data WHERE user_id = 1 AND user_id = 1 AND user_index = $1 AND u_data = ('test', get_local_node_id_stable())::user_data RETURNING *; +EXECUTE router_with_param_and_func_on_non_dist_key(0); + user_id | u_data | user_index +--------------------------------------------------------------------- + 1 | (test,0) | 0 +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(1); + user_id | u_data | user_index +--------------------------------------------------------------------- + 1 | (test,0) | 1 +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(2); + user_id | u_data | user_index +--------------------------------------------------------------------- + 1 | (test,0) | 2 +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(3); + user_id | u_data | user_index +--------------------------------------------------------------------- + 1 | (test,0) | 3 +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(4); + user_id | u_data | user_index +--------------------------------------------------------------------- + 1 | (test,0) | 4 +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(5); + user_id | u_data | user_index +--------------------------------------------------------------------- + 1 | (test,0) | 5 +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(6); + user_id | u_data | user_index +--------------------------------------------------------------------- + 1 | (test,0) | 6 +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(7); + user_id | u_data | user_index +--------------------------------------------------------------------- + 1 | (test,0) | 7 +(1 row) + INSERT INTO user_info_data SELECT 1, ('test' || i, 0)::user_data FROM generate_series(0,7)i; -PREPARE router_with_param_on_non_dist_key_and_func(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 1 AND user_id = 1 RETURNING *; +PREPARE router_with_param_on_non_dist_key_and_func(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 1 AND user_id = 1 RETURNING user_id, u_data; EXECUTE router_with_param_on_non_dist_key_and_func(('test0', get_local_node_id_stable())::user_data); user_id | u_data --------------------------------------------------------------------- @@ -560,7 +660,7 @@ EXECUTE router_with_param_on_non_dist_key_and_func(('test7', get_local_node_id_s (1 row) INSERT INTO user_info_data SELECT 1, ('test', i)::user_data FROM generate_series(0,7)i; -PREPARE router_with_param_on_non_dist_key(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 1 AND user_id = 1 RETURNING *; +PREPARE router_with_param_on_non_dist_key(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 1 AND user_id = 1 RETURNING user_id, u_data; EXECUTE router_with_param_on_non_dist_key(('test', 0)::user_data); user_id | u_data --------------------------------------------------------------------- @@ -611,7 +711,7 @@ EXECUTE router_with_param_on_non_dist_key(('test', 7)::user_data); INSERT INTO user_info_data SELECT i, ('test', i)::user_data FROM generate_series(0,7)i; PREPARE router_with_two_params(user_data, int) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = $2 AND user_id = $2 RETURNING - *; + user_id, u_data; EXECUTE router_with_two_params(('test', 0)::user_data, 0); user_id | u_data --------------------------------------------------------------------- @@ -661,7 +761,7 @@ EXECUTE router_with_two_params(('test', 7)::user_data, 7); (1 row) INSERT INTO user_info_data VALUES(1, ('test', 1)::user_data); -PREPARE router_with_only_function AS DELETE FROM user_info_data WHERE get_local_node_id_stable() = 0 AND user_id = 1 AND user_id = 1 RETURNING *; +PREPARE router_with_only_function AS DELETE FROM user_info_data WHERE get_local_node_id_stable() = 0 AND user_id = 1 AND user_id = 1 RETURNING user_id, u_data; EXECUTE router_with_only_function; user_id | u_data --------------------------------------------------------------------- @@ -732,7 +832,7 @@ INSERT INTO user_info_data (user_id, u_data) VALUES (9, '(''test9'', 9)'), (11, '(''test11'', 11)'), (12, '(''test12'', 12)'), (14, '(''test14'', 14)'), (16, '(''test16'', 16)'); -- make sure that it is also true for fast-path router queries with paramaters -PREPARE fast_path_router_with_param(int) AS DELETE FROM user_info_data WHERE user_id = $1 RETURNING *; +PREPARE fast_path_router_with_param(int) AS DELETE FROM user_info_data WHERE user_id = $1 RETURNING user_id, u_data; execute fast_path_router_with_param(3); NOTICE: executing the command locally: DELETE FROM master_evaluation_combinations_modify.user_info_data_1180001 user_info_data WHERE (user_id OPERATOR(pg_catalog.=) 3) RETURNING user_id, u_data user_id | u_data @@ -794,7 +894,7 @@ INSERT INTO user_info_data (user_id, u_data) VALUES (9, '(''test'', 9)'), (11, '(''test'', 2)'), (12, '(''test'', 2)'), (14, '(''test'', 2)'), (16, '(''test'', 2)'); -- make sure that it is also true for fast-path router queries with paramaters -PREPARE fast_path_router_with_param_and_func(int) AS DELETE FROM user_info_data WHERE u_data = ('''test''', get_constant_stable())::user_data AND user_id = $1 RETURNING *; +PREPARE fast_path_router_with_param_and_func(int) AS DELETE FROM user_info_data WHERE u_data = ('''test''', get_constant_stable())::user_data AND user_id = $1 RETURNING user_id, u_data; execute fast_path_router_with_param_and_func(3); NOTICE: executing the command locally: DELETE FROM master_evaluation_combinations_modify.user_info_data_1180001 user_info_data WHERE ((u_data OPERATOR(pg_catalog.=) '(''test'',2)'::master_evaluation_combinations_modify.user_data) AND (user_id OPERATOR(pg_catalog.=) 3)) RETURNING user_id, u_data user_id | u_data @@ -850,7 +950,66 @@ NOTICE: executing the command locally: DELETE FROM master_evaluation_combinatio 16 | ('test',2) (1 row) -PREPARE fast_path_router_with_param_on_non_dist_key_and_func(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 3 RETURNING *; +INSERT INTO user_info_data SELECT 3, ('test', get_local_node_id_stable() > 0)::user_data, i FROM generate_series(0,7)i; +PREPARE fast_path_router_with_param_and_func_on_non_dist_key(int) AS + DELETE FROM user_info_data WHERE user_id = 3 AND user_index = $1 AND u_data = ('test', (get_local_node_id_stable() > 0)::int)::user_data RETURNING user_id, user_index; +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(0); +NOTICE: executing the command locally: DELETE FROM master_evaluation_combinations_modify.user_info_data_1180001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) 0) AND (u_data OPERATOR(pg_catalog.=) '(test,1)'::master_evaluation_combinations_modify.user_data)) RETURNING user_id, user_index + user_id | user_index +--------------------------------------------------------------------- + 3 | 0 +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(1); +NOTICE: executing the command locally: DELETE FROM master_evaluation_combinations_modify.user_info_data_1180001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) 1) AND (u_data OPERATOR(pg_catalog.=) '(test,1)'::master_evaluation_combinations_modify.user_data)) RETURNING user_id, user_index + user_id | user_index +--------------------------------------------------------------------- + 3 | 1 +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(2); +NOTICE: executing the command locally: DELETE FROM master_evaluation_combinations_modify.user_info_data_1180001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) 2) AND (u_data OPERATOR(pg_catalog.=) '(test,1)'::master_evaluation_combinations_modify.user_data)) RETURNING user_id, user_index + user_id | user_index +--------------------------------------------------------------------- + 3 | 2 +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(3); +NOTICE: executing the command locally: DELETE FROM master_evaluation_combinations_modify.user_info_data_1180001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) 3) AND (u_data OPERATOR(pg_catalog.=) '(test,1)'::master_evaluation_combinations_modify.user_data)) RETURNING user_id, user_index + user_id | user_index +--------------------------------------------------------------------- + 3 | 3 +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(4); +NOTICE: executing the command locally: DELETE FROM master_evaluation_combinations_modify.user_info_data_1180001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) 4) AND (u_data OPERATOR(pg_catalog.=) '(test,1)'::master_evaluation_combinations_modify.user_data)) RETURNING user_id, user_index + user_id | user_index +--------------------------------------------------------------------- + 3 | 4 +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(5); +NOTICE: executing the command locally: DELETE FROM master_evaluation_combinations_modify.user_info_data_1180001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) 5) AND (u_data OPERATOR(pg_catalog.=) '(test,1)'::master_evaluation_combinations_modify.user_data)) RETURNING user_id, user_index + user_id | user_index +--------------------------------------------------------------------- + 3 | 5 +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(6); +NOTICE: executing the command locally: DELETE FROM master_evaluation_combinations_modify.user_info_data_1180001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) 6) AND (u_data OPERATOR(pg_catalog.=) '(test,1)'::master_evaluation_combinations_modify.user_data)) RETURNING user_id, user_index + user_id | user_index +--------------------------------------------------------------------- + 3 | 6 +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(7); +NOTICE: executing the command locally: DELETE FROM master_evaluation_combinations_modify.user_info_data_1180001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) 7) AND (u_data OPERATOR(pg_catalog.=) '(test,1)'::master_evaluation_combinations_modify.user_data)) RETURNING user_id, user_index + user_id | user_index +--------------------------------------------------------------------- + 3 | 7 +(1 row) + +PREPARE fast_path_router_with_param_on_non_dist_key_and_func(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 3 RETURNING user_id, u_data; INSERT INTO user_info_data (user_id, u_data) VALUES (3, '(''test'', 2)'::user_data); NOTICE: executing the command locally: INSERT INTO master_evaluation_combinations_modify.user_info_data_1180001 (user_id, u_data) VALUES (3, '(''test'',2)'::master_evaluation_combinations_modify.user_data) EXECUTE fast_path_router_with_param_on_non_dist_key_and_func(('''test''', get_constant_stable())::user_data); @@ -914,7 +1073,7 @@ NOTICE: executing the command locally: DELETE FROM master_evaluation_combinatio 3 | ('test',2) (1 row) -PREPARE fast_path_router_with_param_on_non_dist_key(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 3 RETURNING *; +PREPARE fast_path_router_with_param_on_non_dist_key(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 3 RETURNING user_id, u_data; INSERT INTO user_info_data (user_id, u_data) VALUES (3, ('test', 1)::user_data); NOTICE: executing the command locally: INSERT INTO master_evaluation_combinations_modify.user_info_data_1180001 (user_id, u_data) VALUES (3, ROW('test'::text, 1)::master_evaluation_combinations_modify.user_data) EXECUTE fast_path_router_with_param_on_non_dist_key(('test', 1)::user_data); @@ -982,7 +1141,7 @@ INSERT INTO user_info_data (user_id, u_data) VALUES (3, ('test', 2)), (4, ('test', 2)), (7, ('test', 2)), (9, ('test', 2)), (11, ('test', 2)), (12, ('test', 2)), (14, ('test', 2)), (16, ('test', 2)); -PREPARE fast_path_router_with_two_params(user_data, int) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = $2 RETURNING *; +PREPARE fast_path_router_with_two_params(user_data, int) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = $2 RETURNING user_id, u_data; EXECUTE fast_path_router_with_two_params(('test', 2)::user_data, 3); NOTICE: executing the command locally: DELETE FROM master_evaluation_combinations_modify.user_info_data_1180001 user_info_data WHERE ((u_data OPERATOR(pg_catalog.=) '(test,2)'::master_evaluation_combinations_modify.user_data) AND (user_id OPERATOR(pg_catalog.=) 3)) RETURNING user_id, u_data user_id | u_data @@ -1039,7 +1198,7 @@ NOTICE: executing the command locally: DELETE FROM master_evaluation_combinatio 16 | (test,2) (1 row) -PREPARE fast_path_router_with_only_function AS DELETE FROM user_info_data WHERE get_constant_stable() = 2AND user_id = 3 RETURNING *; +PREPARE fast_path_router_with_only_function AS DELETE FROM user_info_data WHERE get_constant_stable() = 2AND user_id = 3 RETURNING user_id, u_data; INSERT INTO user_info_data (user_id, u_data) VALUES (3, ('test', 2)::user_data); NOTICE: executing the command locally: INSERT INTO master_evaluation_combinations_modify.user_info_data_1180001 (user_id, u_data) VALUES (3, ROW('test'::text, 2)::master_evaluation_combinations_modify.user_data) EXECUTE fast_path_router_with_only_function; @@ -1103,69 +1262,64 @@ NOTICE: executing the command locally: DELETE FROM master_evaluation_combinatio 3 | (test,2) (1 row) ---------------------------------------------------------------------- -\c - - - :master_port -SET search_path TO master_evaluation_combinations_modify; -ALTER TABLE user_info_data ADD COLUMN user_index INT; -\c - - - :worker_2_port -SET search_path TO master_evaluation_combinations_modify; -PREPARE insert_with_function_and_param(user_data) AS INSERT INTO user_info_data VALUES (3, $1, get_local_node_id_stable()) RETURNING user_id; +PREPARE insert_with_function_and_param(user_data) AS INSERT INTO user_info_data VALUES (3, $1, (get_local_node_id_stable() > 0)::int) RETURNING user_id; EXECUTE insert_with_function_and_param(('test', 1)::user_data); +NOTICE: executing the command locally: INSERT INTO master_evaluation_combinations_modify.user_info_data_1180001 (user_id, u_data, user_index) VALUES (3, '(test,1)'::master_evaluation_combinations_modify.user_data, 1) RETURNING user_id user_id --------------------------------------------------------------------- 3 (1 row) EXECUTE insert_with_function_and_param(('test', 1)::user_data); +NOTICE: executing the command locally: INSERT INTO master_evaluation_combinations_modify.user_info_data_1180001 (user_id, u_data, user_index) VALUES (3, '(test,1)'::master_evaluation_combinations_modify.user_data, 1) RETURNING user_id user_id --------------------------------------------------------------------- 3 (1 row) EXECUTE insert_with_function_and_param(('test', 1)::user_data); +NOTICE: executing the command locally: INSERT INTO master_evaluation_combinations_modify.user_info_data_1180001 (user_id, u_data, user_index) VALUES (3, '(test,1)'::master_evaluation_combinations_modify.user_data, 1) RETURNING user_id user_id --------------------------------------------------------------------- 3 (1 row) EXECUTE insert_with_function_and_param(('test', 1)::user_data); +NOTICE: executing the command locally: INSERT INTO master_evaluation_combinations_modify.user_info_data_1180001 (user_id, u_data, user_index) VALUES (3, '(test,1)'::master_evaluation_combinations_modify.user_data, 1) RETURNING user_id user_id --------------------------------------------------------------------- 3 (1 row) EXECUTE insert_with_function_and_param(('test', 1)::user_data); +NOTICE: executing the command locally: INSERT INTO master_evaluation_combinations_modify.user_info_data_1180001 (user_id, u_data, user_index) VALUES (3, '(test,1)'::master_evaluation_combinations_modify.user_data, 1) RETURNING user_id user_id --------------------------------------------------------------------- 3 (1 row) EXECUTE insert_with_function_and_param(('test', 1)::user_data); +NOTICE: executing the command locally: INSERT INTO master_evaluation_combinations_modify.user_info_data_1180001 (user_id, u_data, user_index) VALUES (3, '(test,1)'::master_evaluation_combinations_modify.user_data, 1) RETURNING user_id user_id --------------------------------------------------------------------- 3 (1 row) EXECUTE insert_with_function_and_param(('test', 1)::user_data); +NOTICE: executing the command locally: INSERT INTO master_evaluation_combinations_modify.user_info_data_1180001 (user_id, u_data, user_index) VALUES (3, '(test,1)'::master_evaluation_combinations_modify.user_data, 1) RETURNING user_id user_id --------------------------------------------------------------------- 3 (1 row) -\c - - - :master_port -SET search_path TO master_evaluation_combinations_modify; -ALTER TABLE user_info_data DROP COLUMN user_index; TRUNCATE user_info_data; -\c - - - :worker_2_port -SET citus.log_local_commands TO ON; -SET search_path TO master_evaluation_combinations_modify; -- all local values INSERT INTO user_info_data (user_id, u_data) VALUES (3, '(''test3'', 3)'), (4, '(''test4'', 4)'), (7, '(''test7'', 7)'), (9, '(''test9'', 9)'), (11, '(''test11'', 11)'), (12, '(''test12'', 12)'), (14, '(''test14'', 14)'), (16, '(''test16'', 16)'); -- make sure that it is also true for fast-path router queries with paramaters -PREPARE router_with_param(int) AS DELETE FROM user_info_data WHERE user_id = $1 AND user_id = $1 RETURNING *; +PREPARE router_with_param(int) AS DELETE FROM user_info_data WHERE user_id = $1 AND user_id = $1 RETURNING user_id, u_data; execute router_with_param(3); NOTICE: executing the command locally: DELETE FROM master_evaluation_combinations_modify.user_info_data_1180001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) $1) AND (user_id OPERATOR(pg_catalog.=) $1)) RETURNING user_id, u_data user_id | u_data @@ -1227,7 +1381,7 @@ INSERT INTO user_info_data (user_id, u_data) VALUES (9, '(''test'', 9)'), (11, '(''test'', 2)'), (12, '(''test'', 2)'), (14, '(''test'', 2)'), (16, '(''test'', 2)'); -- make sure that it is also true for fast-path router queries with paramaters -PREPARE router_with_param_and_func(int) AS DELETE FROM user_info_data WHERE u_data = ('''test''', get_constant_stable())::user_data AND user_id = $1 AND user_id = $1 RETURNING *; +PREPARE router_with_param_and_func(int) AS DELETE FROM user_info_data WHERE u_data = ('''test''', get_constant_stable())::user_data AND user_id = $1 AND user_id = $1 RETURNING user_id, u_data; execute router_with_param_and_func(3); NOTICE: executing the command locally: DELETE FROM master_evaluation_combinations_modify.user_info_data_1180001 user_info_data WHERE ((u_data OPERATOR(pg_catalog.=) '(''test'',2)'::master_evaluation_combinations_modify.user_data) AND (user_id OPERATOR(pg_catalog.=) 3) AND (user_id OPERATOR(pg_catalog.=) 3)) RETURNING user_id, u_data user_id | u_data @@ -1283,7 +1437,66 @@ NOTICE: executing the command locally: DELETE FROM master_evaluation_combinatio 16 | ('test',2) (1 row) -PREPARE router_with_param_on_non_dist_key_and_func(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 3 AND user_id = 3 RETURNING *; +INSERT INTO user_info_data SELECT 3, ('test', get_local_node_id_stable() > 0)::user_data, i FROM generate_series(0,7)i; +PREPARE router_with_param_and_func_on_non_dist_key(int) AS + DELETE FROM user_info_data WHERE user_id = 3 AND user_id = 3 AND user_index = $1 AND u_data = ('test', (get_local_node_id_stable() > 0)::int)::user_data RETURNING user_id, user_index; +EXECUTE router_with_param_and_func_on_non_dist_key(0); +NOTICE: executing the command locally: DELETE FROM master_evaluation_combinations_modify.user_info_data_1180001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) 0) AND (u_data OPERATOR(pg_catalog.=) '(test,1)'::master_evaluation_combinations_modify.user_data)) RETURNING user_id, user_index + user_id | user_index +--------------------------------------------------------------------- + 3 | 0 +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(1); +NOTICE: executing the command locally: DELETE FROM master_evaluation_combinations_modify.user_info_data_1180001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) 1) AND (u_data OPERATOR(pg_catalog.=) '(test,1)'::master_evaluation_combinations_modify.user_data)) RETURNING user_id, user_index + user_id | user_index +--------------------------------------------------------------------- + 3 | 1 +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(2); +NOTICE: executing the command locally: DELETE FROM master_evaluation_combinations_modify.user_info_data_1180001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) 2) AND (u_data OPERATOR(pg_catalog.=) '(test,1)'::master_evaluation_combinations_modify.user_data)) RETURNING user_id, user_index + user_id | user_index +--------------------------------------------------------------------- + 3 | 2 +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(3); +NOTICE: executing the command locally: DELETE FROM master_evaluation_combinations_modify.user_info_data_1180001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) 3) AND (u_data OPERATOR(pg_catalog.=) '(test,1)'::master_evaluation_combinations_modify.user_data)) RETURNING user_id, user_index + user_id | user_index +--------------------------------------------------------------------- + 3 | 3 +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(4); +NOTICE: executing the command locally: DELETE FROM master_evaluation_combinations_modify.user_info_data_1180001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) 4) AND (u_data OPERATOR(pg_catalog.=) '(test,1)'::master_evaluation_combinations_modify.user_data)) RETURNING user_id, user_index + user_id | user_index +--------------------------------------------------------------------- + 3 | 4 +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(5); +NOTICE: executing the command locally: DELETE FROM master_evaluation_combinations_modify.user_info_data_1180001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) 5) AND (u_data OPERATOR(pg_catalog.=) '(test,1)'::master_evaluation_combinations_modify.user_data)) RETURNING user_id, user_index + user_id | user_index +--------------------------------------------------------------------- + 3 | 5 +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(6); +NOTICE: executing the command locally: DELETE FROM master_evaluation_combinations_modify.user_info_data_1180001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) 6) AND (u_data OPERATOR(pg_catalog.=) '(test,1)'::master_evaluation_combinations_modify.user_data)) RETURNING user_id, user_index + user_id | user_index +--------------------------------------------------------------------- + 3 | 6 +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(7); +NOTICE: executing the command locally: DELETE FROM master_evaluation_combinations_modify.user_info_data_1180001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) 7) AND (u_data OPERATOR(pg_catalog.=) '(test,1)'::master_evaluation_combinations_modify.user_data)) RETURNING user_id, user_index + user_id | user_index +--------------------------------------------------------------------- + 3 | 7 +(1 row) + +PREPARE router_with_param_on_non_dist_key_and_func(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 3 AND user_id = 3 RETURNING user_id, u_data; INSERT INTO user_info_data (user_id, u_data) VALUES (3, '(''test'', 2)'::user_data); NOTICE: executing the command locally: INSERT INTO master_evaluation_combinations_modify.user_info_data_1180001 (user_id, u_data) VALUES (3, '(''test'',2)'::master_evaluation_combinations_modify.user_data) EXECUTE router_with_param_on_non_dist_key_and_func(('''test''', get_constant_stable())::user_data); @@ -1347,7 +1560,7 @@ NOTICE: executing the command locally: DELETE FROM master_evaluation_combinatio 3 | ('test',2) (1 row) -PREPARE router_with_param_on_non_dist_key(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 3 AND user_id = 3 RETURNING *; +PREPARE router_with_param_on_non_dist_key(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 3 AND user_id = 3 RETURNING user_id, u_data; INSERT INTO user_info_data (user_id, u_data) VALUES (3, ('test', 1)::user_data); NOTICE: executing the command locally: INSERT INTO master_evaluation_combinations_modify.user_info_data_1180001 (user_id, u_data) VALUES (3, ROW('test'::text, 1)::master_evaluation_combinations_modify.user_data) EXECUTE router_with_param_on_non_dist_key(('test', 1)::user_data); @@ -1415,7 +1628,7 @@ INSERT INTO user_info_data (user_id, u_data) VALUES (3, ('test', 2)), (4, ('test', 2)), (7, ('test', 2)), (9, ('test', 2)), (11, ('test', 2)), (12, ('test', 2)), (14, ('test', 2)), (16, ('test', 2)); -PREPARE router_with_two_params(user_data, int) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = $2 AND user_id = $2 RETURNING *; +PREPARE router_with_two_params(user_data, int) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = $2 AND user_id = $2 RETURNING user_id, u_data; EXECUTE router_with_two_params(('test', 2)::user_data, 3); NOTICE: executing the command locally: DELETE FROM master_evaluation_combinations_modify.user_info_data_1180001 user_info_data WHERE ((u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations_modify.user_data) AND (user_id OPERATOR(pg_catalog.=) $2) AND (user_id OPERATOR(pg_catalog.=) $2)) RETURNING user_id, u_data user_id | u_data @@ -1472,7 +1685,7 @@ NOTICE: executing the command locally: DELETE FROM master_evaluation_combinatio 16 | (test,2) (1 row) -PREPARE router_with_only_function AS DELETE FROM user_info_data WHERE get_constant_stable() = 2AND user_id = 3 RETURNING *; +PREPARE router_with_only_function AS DELETE FROM user_info_data WHERE get_constant_stable() = 2AND user_id = 3 RETURNING user_id, u_data; INSERT INTO user_info_data (user_id, u_data) VALUES (3, ('test', 2)::user_data); NOTICE: executing the command locally: INSERT INTO master_evaluation_combinations_modify.user_info_data_1180001 (user_id, u_data) VALUES (3, ROW('test'::text, 2)::master_evaluation_combinations_modify.user_data) EXECUTE router_with_only_function; diff --git a/src/test/regress/expected/master_evaluation_select.out b/src/test/regress/expected/master_evaluation_select.out index 7392f479c..d646ae832 100644 --- a/src/test/regress/expected/master_evaluation_select.out +++ b/src/test/regress/expected/master_evaluation_select.out @@ -29,7 +29,7 @@ SELECT create_distributed_function('get_local_node_id_volatile()'); CREATE TYPE user_data AS (name text, age int); SET citus.replication_model TO streaming; SET citus.shard_replication_factor TO 1; -CREATE TABLE user_info_data (user_id int, u_data user_data); +CREATE TABLE user_info_data (user_id int, u_data user_data, user_index int); SELECT create_distributed_table('user_info_data', 'user_id'); create_distributed_table --------------------------------------------------------------------- @@ -44,7 +44,7 @@ SELECT get_local_node_id_volatile(); (1 row) -- load data -INSERT INTO user_info_data SELECT i, ('name' || i, i % 20 + 20)::user_data FROM generate_series(0,100)i; +INSERT INTO user_info_data SELECT i, ('name' || i, i % 20 + 20)::user_data, i FROM generate_series(0,100)i; -- we expect that the function is evaluated on the worker node, so we should get a row SELECT get_local_node_id_volatile() > 0 FROM user_info_data WHERE user_id = 1; ?column? @@ -158,6 +158,50 @@ execute fast_path_router_with_param_and_func(8); t (1 row) +PREPARE fast_path_router_with_param_and_func_on_non_dist_key(int) AS + SELECT get_local_node_id_volatile() > 0 FROM user_info_data WHERE user_id = 1 AND user_index = $1; +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(1); + ?column? +--------------------------------------------------------------------- + t +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(1); + ?column? +--------------------------------------------------------------------- + t +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(1); + ?column? +--------------------------------------------------------------------- + t +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(1); + ?column? +--------------------------------------------------------------------- + t +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(1); + ?column? +--------------------------------------------------------------------- + t +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(1); + ?column? +--------------------------------------------------------------------- + t +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(1); + ?column? +--------------------------------------------------------------------- + t +(1 row) + SELECT get_local_node_id_volatile() > 0 FROM user_info_data WHERE user_id = 1 AND u_data = ('name1', 21)::user_data; ?column? --------------------------------------------------------------------- @@ -495,6 +539,50 @@ execute router_with_param_and_func(8); t (1 row) +PREPARE router_with_param_and_func_on_non_dist_key(int) AS + SELECT get_local_node_id_volatile() > 0 FROM user_info_data WHERE user_id = 1 AND user_id = 1 AND user_index = $1; +EXECUTE router_with_param_and_func_on_non_dist_key(1); + ?column? +--------------------------------------------------------------------- + t +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(1); + ?column? +--------------------------------------------------------------------- + t +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(1); + ?column? +--------------------------------------------------------------------- + t +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(1); + ?column? +--------------------------------------------------------------------- + t +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(1); + ?column? +--------------------------------------------------------------------- + t +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(1); + ?column? +--------------------------------------------------------------------- + t +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(1); + ?column? +--------------------------------------------------------------------- + t +(1 row) + -- same query as router_with_param, but with consts SELECT get_local_node_id_volatile() > 0 FROM user_info_data m1 JOIN user_info_data m2 USING(user_id) WHERE m1.user_id = 1; ?column? @@ -867,6 +955,57 @@ execute fast_path_router_with_param_and_func(8); t (1 row) +PREPARE fast_path_router_with_param_and_func_on_non_dist_key(int) AS + SELECT get_local_node_id_volatile() > 0 FROM user_info_data WHERE user_id = 3 AND user_index = $1; +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(3); +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM master_evaluation_combinations.user_info_data_1170001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) $1)) + ?column? +--------------------------------------------------------------------- + t +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(3); +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM master_evaluation_combinations.user_info_data_1170001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) $1)) + ?column? +--------------------------------------------------------------------- + t +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(3); +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM master_evaluation_combinations.user_info_data_1170001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) $1)) + ?column? +--------------------------------------------------------------------- + t +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(3); +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM master_evaluation_combinations.user_info_data_1170001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) $1)) + ?column? +--------------------------------------------------------------------- + t +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(3); +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM master_evaluation_combinations.user_info_data_1170001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) $1)) + ?column? +--------------------------------------------------------------------- + t +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(3); +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM master_evaluation_combinations.user_info_data_1170001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) $1)) + ?column? +--------------------------------------------------------------------- + t +(1 row) + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(3); +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM master_evaluation_combinations.user_info_data_1170001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) $1)) + ?column? +--------------------------------------------------------------------- + t +(1 row) + SELECT get_local_node_id_volatile() > 0 FROM user_info_data WHERE user_id = 3 AND u_data = ('name3', 23)::user_data; NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM master_evaluation_combinations.user_info_data_1170001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (u_data OPERATOR(pg_catalog.=) ROW('name3'::text, 23)::master_evaluation_combinations.user_data)) ?column? @@ -1074,7 +1213,7 @@ NOTICE: executing the command locally: SELECT (master_evaluation_combinations.g (1 row) SELECT count(*) FROM user_info_data u1 JOIN user_info_data u2 USING (user_id) WHERE user_id = 3; -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) 3) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) 3) count --------------------------------------------------------------------- 1 @@ -1083,63 +1222,63 @@ NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_ev -- make sure that it is also true for fast-path router queries with paramaters PREPARE router_with_param(int) AS SELECT count(*) FROM user_info_data u1 JOIN user_info_data u2 USING (user_id) WHERE user_id = $1; execute router_with_param(3); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) $1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) $1) count --------------------------------------------------------------------- 1 (1 row) execute router_with_param(3); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) $1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) $1) count --------------------------------------------------------------------- 1 (1 row) execute router_with_param(3); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) $1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) $1) count --------------------------------------------------------------------- 1 (1 row) execute router_with_param(3); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) $1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) $1) count --------------------------------------------------------------------- 1 (1 row) execute router_with_param(3); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) $1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) $1) count --------------------------------------------------------------------- 1 (1 row) execute router_with_param(3); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) $1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) $1) count --------------------------------------------------------------------- 1 (1 row) execute router_with_param(3); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) $1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) $1) count --------------------------------------------------------------------- 1 (1 row) execute router_with_param(3); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) $1) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) $1) count --------------------------------------------------------------------- 1 (1 row) SELECT get_local_node_id_volatile() > 0 FROM user_info_data m1 JOIN user_info_data m2 USING(user_id) WHERE m1.user_id = 3; -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 m1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 m2(user_id, u_data) USING (user_id)) WHERE (m1.user_id OPERATOR(pg_catalog.=) 3) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 m1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 m2(user_id, u_data, user_index) USING (user_id)) WHERE (m1.user_id OPERATOR(pg_catalog.=) 3) ?column? --------------------------------------------------------------------- t @@ -1147,56 +1286,107 @@ NOTICE: executing the command locally: SELECT (master_evaluation_combinations.g PREPARE router_with_param_and_func(int) AS SELECT get_local_node_id_volatile() > 0 FROM user_info_data m1 JOIN user_info_data m2 USING(user_id) WHERE m1.user_id = $1; execute router_with_param_and_func(3); -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 m1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 m2(user_id, u_data) USING (user_id)) WHERE (m1.user_id OPERATOR(pg_catalog.=) $1) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 m1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 m2(user_id, u_data, user_index) USING (user_id)) WHERE (m1.user_id OPERATOR(pg_catalog.=) $1) ?column? --------------------------------------------------------------------- t (1 row) execute router_with_param_and_func(3); -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 m1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 m2(user_id, u_data) USING (user_id)) WHERE (m1.user_id OPERATOR(pg_catalog.=) $1) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 m1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 m2(user_id, u_data, user_index) USING (user_id)) WHERE (m1.user_id OPERATOR(pg_catalog.=) $1) ?column? --------------------------------------------------------------------- t (1 row) execute router_with_param_and_func(3); -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 m1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 m2(user_id, u_data) USING (user_id)) WHERE (m1.user_id OPERATOR(pg_catalog.=) $1) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 m1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 m2(user_id, u_data, user_index) USING (user_id)) WHERE (m1.user_id OPERATOR(pg_catalog.=) $1) ?column? --------------------------------------------------------------------- t (1 row) execute router_with_param_and_func(3); -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 m1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 m2(user_id, u_data) USING (user_id)) WHERE (m1.user_id OPERATOR(pg_catalog.=) $1) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 m1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 m2(user_id, u_data, user_index) USING (user_id)) WHERE (m1.user_id OPERATOR(pg_catalog.=) $1) ?column? --------------------------------------------------------------------- t (1 row) execute router_with_param_and_func(3); -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 m1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 m2(user_id, u_data) USING (user_id)) WHERE (m1.user_id OPERATOR(pg_catalog.=) $1) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 m1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 m2(user_id, u_data, user_index) USING (user_id)) WHERE (m1.user_id OPERATOR(pg_catalog.=) $1) ?column? --------------------------------------------------------------------- t (1 row) execute router_with_param_and_func(3); -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 m1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 m2(user_id, u_data) USING (user_id)) WHERE (m1.user_id OPERATOR(pg_catalog.=) $1) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 m1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 m2(user_id, u_data, user_index) USING (user_id)) WHERE (m1.user_id OPERATOR(pg_catalog.=) $1) ?column? --------------------------------------------------------------------- t (1 row) execute router_with_param_and_func(3); -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 m1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 m2(user_id, u_data) USING (user_id)) WHERE (m1.user_id OPERATOR(pg_catalog.=) $1) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 m1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 m2(user_id, u_data, user_index) USING (user_id)) WHERE (m1.user_id OPERATOR(pg_catalog.=) $1) ?column? --------------------------------------------------------------------- t (1 row) execute router_with_param_and_func(3); -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 m1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 m2(user_id, u_data) USING (user_id)) WHERE (m1.user_id OPERATOR(pg_catalog.=) $1) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 m1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 m2(user_id, u_data, user_index) USING (user_id)) WHERE (m1.user_id OPERATOR(pg_catalog.=) $1) + ?column? +--------------------------------------------------------------------- + t +(1 row) + +PREPARE router_with_param_and_func_on_non_dist_key(int) AS + SELECT get_local_node_id_volatile() > 0 FROM user_info_data WHERE user_id = 3 AND user_id = 3 AND user_index = $1; +EXECUTE router_with_param_and_func_on_non_dist_key(3); +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM master_evaluation_combinations.user_info_data_1170001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) $1)) + ?column? +--------------------------------------------------------------------- + t +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(3); +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM master_evaluation_combinations.user_info_data_1170001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) $1)) + ?column? +--------------------------------------------------------------------- + t +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(3); +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM master_evaluation_combinations.user_info_data_1170001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) $1)) + ?column? +--------------------------------------------------------------------- + t +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(3); +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM master_evaluation_combinations.user_info_data_1170001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) $1)) + ?column? +--------------------------------------------------------------------- + t +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(3); +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM master_evaluation_combinations.user_info_data_1170001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) $1)) + ?column? +--------------------------------------------------------------------- + t +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(3); +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM master_evaluation_combinations.user_info_data_1170001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) $1)) + ?column? +--------------------------------------------------------------------- + t +(1 row) + +EXECUTE router_with_param_and_func_on_non_dist_key(3); +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM master_evaluation_combinations.user_info_data_1170001 user_info_data WHERE ((user_id OPERATOR(pg_catalog.=) 3) AND (user_id OPERATOR(pg_catalog.=) 3) AND (user_index OPERATOR(pg_catalog.=) $1)) ?column? --------------------------------------------------------------------- t @@ -1204,21 +1394,21 @@ NOTICE: executing the command locally: SELECT (master_evaluation_combinations.g -- same query as router_with_param, but with consts SELECT get_local_node_id_volatile() > 0 FROM user_info_data m1 JOIN user_info_data m2 USING(user_id) WHERE m1.user_id = 3; -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 m1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 m2(user_id, u_data) USING (user_id)) WHERE (m1.user_id OPERATOR(pg_catalog.=) 3) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 m1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 m2(user_id, u_data, user_index) USING (user_id)) WHERE (m1.user_id OPERATOR(pg_catalog.=) 3) ?column? --------------------------------------------------------------------- t (1 row) SELECT count(*) FROM user_info_data u1 JOIN user_info_data u2 USING (user_id) WHERE u1.user_id = 3 AND u1.u_data = ('name3', 23)::user_data; -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) ROW('name3'::text, 23)::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) ROW('name3'::text, 23)::master_evaluation_combinations.user_data)) count --------------------------------------------------------------------- 1 (1 row) SELECT count(*) FROM user_info_data u1 JOIN user_info_data u2 USING (user_id) WHERE u1.user_id = 3 AND u1.u_data = ('name3', 23)::user_data; -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) ROW('name3'::text, 23)::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) ROW('name3'::text, 23)::master_evaluation_combinations.user_data)) count --------------------------------------------------------------------- 1 @@ -1226,70 +1416,70 @@ NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_ev PREPARE router_with_param_on_non_dist_key(user_data) AS SELECT count(*) FROM user_info_data u1 JOIN user_info_data u2 USING (user_id) WHERE u1.user_id = 3 AND u1.u_data = $1; EXECUTE router_with_param_on_non_dist_key(('name3', 23)::user_data); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) count --------------------------------------------------------------------- 1 (1 row) EXECUTE router_with_param_on_non_dist_key(('name3', 23)::user_data); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) count --------------------------------------------------------------------- 1 (1 row) EXECUTE router_with_param_on_non_dist_key(('name3', 23)::user_data); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) count --------------------------------------------------------------------- 1 (1 row) EXECUTE router_with_param_on_non_dist_key(('name3', 23)::user_data); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) count --------------------------------------------------------------------- 1 (1 row) EXECUTE router_with_param_on_non_dist_key(('name3', 23)::user_data); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) count --------------------------------------------------------------------- 1 (1 row) EXECUTE router_with_param_on_non_dist_key(('name3', 23)::user_data); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) count --------------------------------------------------------------------- 1 (1 row) EXECUTE router_with_param_on_non_dist_key(('name3', 23)::user_data); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) count --------------------------------------------------------------------- 1 (1 row) EXECUTE router_with_param_on_non_dist_key(('name3', 23)::user_data); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) count --------------------------------------------------------------------- 1 (1 row) EXECUTE router_with_param_on_non_dist_key(('name3', 23)::user_data); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) count --------------------------------------------------------------------- 1 (1 row) SELECT get_local_node_id_volatile() > 0 FROM user_info_data u1 JOIN user_info_data u2 USING (user_id) WHERE u1.user_id = 3 AND u1.u_data = ('name3', 23)::user_data; -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) ROW('name3'::text, 23)::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) ROW('name3'::text, 23)::master_evaluation_combinations.user_data)) ?column? --------------------------------------------------------------------- t @@ -1297,70 +1487,70 @@ NOTICE: executing the command locally: SELECT (master_evaluation_combinations.g PREPARE router_with_param_on_non_dist_key_and_func(user_data) AS SELECT get_local_node_id_volatile() > 0 FROM user_info_data u1 JOIN user_info_data u2 USING (user_id) WHERE u1.user_id = 3 AND u1.u_data = $1; EXECUTE router_with_param_on_non_dist_key_and_func(('name3', 23)::user_data); -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) ?column? --------------------------------------------------------------------- t (1 row) EXECUTE router_with_param_on_non_dist_key_and_func(('name3', 23)::user_data); -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) ?column? --------------------------------------------------------------------- t (1 row) EXECUTE router_with_param_on_non_dist_key_and_func(('name3', 23)::user_data); -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) ?column? --------------------------------------------------------------------- t (1 row) EXECUTE router_with_param_on_non_dist_key_and_func(('name3', 23)::user_data); -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) ?column? --------------------------------------------------------------------- t (1 row) EXECUTE router_with_param_on_non_dist_key_and_func(('name3', 23)::user_data); -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) ?column? --------------------------------------------------------------------- t (1 row) EXECUTE router_with_param_on_non_dist_key_and_func(('name3', 23)::user_data); -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) ?column? --------------------------------------------------------------------- t (1 row) EXECUTE router_with_param_on_non_dist_key_and_func(('name3', 23)::user_data); -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) ?column? --------------------------------------------------------------------- t (1 row) EXECUTE router_with_param_on_non_dist_key_and_func(('name3', 23)::user_data); -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) ?column? --------------------------------------------------------------------- t (1 row) EXECUTE router_with_param_on_non_dist_key_and_func(('name3', 23)::user_data); -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) ?column? --------------------------------------------------------------------- t (1 row) SELECT count(*) FROM user_info_data u1 JOIN user_info_data u2 USING (user_id) WHERE user_id = 3 AND u1.u_data = ('name3', 23)::user_data; -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) ROW('name3'::text, 23)::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) 3) AND (u1.u_data OPERATOR(pg_catalog.=) ROW('name3'::text, 23)::master_evaluation_combinations.user_data)) count --------------------------------------------------------------------- 1 @@ -1368,70 +1558,70 @@ NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_ev PREPARE router_with_two_params(user_data, int) AS SELECT count(*) FROM user_info_data u1 JOIN user_info_data u2 USING (user_id) WHERE user_id = $2 AND u1.u_data = $1; EXECUTE router_with_two_params(('name3', 23)::user_data, 3); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) $2) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) $2) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) count --------------------------------------------------------------------- 1 (1 row) EXECUTE router_with_two_params(('name3', 23)::user_data, 3); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) $2) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) $2) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) count --------------------------------------------------------------------- 1 (1 row) EXECUTE router_with_two_params(('name3', 23)::user_data, 3); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) $2) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) $2) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) count --------------------------------------------------------------------- 1 (1 row) EXECUTE router_with_two_params(('name3', 23)::user_data, 3); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) $2) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) $2) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) count --------------------------------------------------------------------- 1 (1 row) EXECUTE router_with_two_params(('name3', 23)::user_data, 3); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) $2) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) $2) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) count --------------------------------------------------------------------- 1 (1 row) EXECUTE router_with_two_params(('name3', 23)::user_data, 3); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) $2) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) $2) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) count --------------------------------------------------------------------- 1 (1 row) EXECUTE router_with_two_params(('name3', 23)::user_data, 3); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) $2) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) $2) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) count --------------------------------------------------------------------- 1 (1 row) EXECUTE router_with_two_params(('name3', 23)::user_data, 3); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) $2) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) $2) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) count --------------------------------------------------------------------- 1 (1 row) EXECUTE router_with_two_params(('name3', 23)::user_data, 3); -NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) $2) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) +NOTICE: executing the command locally: SELECT count(*) AS count FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE ((u1.user_id OPERATOR(pg_catalog.=) $2) AND (u1.u_data OPERATOR(pg_catalog.=) $1::master_evaluation_combinations.user_data)) count --------------------------------------------------------------------- 1 (1 row) SELECT get_local_node_id_volatile() > 0 FROM user_info_data u1 JOIN user_info_data u2 USING(user_id) WHERE user_id = 3; -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) 3) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) 3) ?column? --------------------------------------------------------------------- t @@ -1439,56 +1629,56 @@ NOTICE: executing the command locally: SELECT (master_evaluation_combinations.g PREPARE router_with_only_function AS SELECT get_local_node_id_volatile() > 0 FROM user_info_data u1 JOIN user_info_data u2 USING(user_id) WHERE user_id = 3; EXECUTE router_with_only_function; -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) 3) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) 3) ?column? --------------------------------------------------------------------- t (1 row) EXECUTE router_with_only_function; -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) 3) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) 3) ?column? --------------------------------------------------------------------- t (1 row) EXECUTE router_with_only_function; -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) 3) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) 3) ?column? --------------------------------------------------------------------- t (1 row) EXECUTE router_with_only_function; -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) 3) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) 3) ?column? --------------------------------------------------------------------- t (1 row) EXECUTE router_with_only_function; -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) 3) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) 3) ?column? --------------------------------------------------------------------- t (1 row) EXECUTE router_with_only_function; -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) 3) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) 3) ?column? --------------------------------------------------------------------- t (1 row) EXECUTE router_with_only_function; -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) 3) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) 3) ?column? --------------------------------------------------------------------- t (1 row) EXECUTE router_with_only_function; -NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) 3) +NOTICE: executing the command locally: SELECT (master_evaluation_combinations.get_local_node_id_volatile() OPERATOR(pg_catalog.>) 0) FROM (master_evaluation_combinations.user_info_data_1170001 u1(user_id, u_data, user_index) JOIN master_evaluation_combinations.user_info_data_1170001 u2(user_id, u_data, user_index) USING (user_id)) WHERE (u1.user_id OPERATOR(pg_catalog.=) 3) ?column? --------------------------------------------------------------------- t diff --git a/src/test/regress/sql/master_evaluation_modify.sql b/src/test/regress/sql/master_evaluation_modify.sql index 35c9567d4..1fe8cf136 100644 --- a/src/test/regress/sql/master_evaluation_modify.sql +++ b/src/test/regress/sql/master_evaluation_modify.sql @@ -38,7 +38,7 @@ CREATE TYPE user_data AS (name text, age int); SET citus.replication_model TO streaming; SET citus.shard_replication_factor TO 1; -CREATE TABLE user_info_data (user_id int, u_data user_data); +CREATE TABLE user_info_data (user_id int, u_data user_data, user_index int); SELECT create_distributed_table('user_info_data', 'user_id'); -- show that local id is 0, we'll use this information @@ -46,10 +46,10 @@ SELECT get_local_node_id_stable(); -INSERT INTO user_info_data SELECT i, ('name' || i, i % 20 + 20)::user_data FROM generate_series(0,7)i; +INSERT INTO user_info_data SELECT i, ('name' || i, i % 20 + 20)::user_data, i FROM generate_series(0,7)i; -- make sure that it is also true for fast-path router queries with paramaters -PREPARE fast_path_router_with_param(int) AS DELETE FROM user_info_data WHERE user_id = $1 RETURNING *; +PREPARE fast_path_router_with_param(int) AS DELETE FROM user_info_data WHERE user_id = $1 RETURNING user_id, u_data; execute fast_path_router_with_param(0); execute fast_path_router_with_param(1); @@ -62,7 +62,7 @@ execute fast_path_router_with_param(7); -- make sure that it is also true for fast-path router queries with paramaters -PREPARE fast_path_router_with_param_and_func(int) AS DELETE FROM user_info_data WHERE u_data = ('test', get_local_node_id_stable())::user_data AND user_id = $1 RETURNING *; +PREPARE fast_path_router_with_param_and_func(int) AS DELETE FROM user_info_data WHERE u_data = ('test', get_local_node_id_stable())::user_data AND user_id = $1 RETURNING user_id, u_data; INSERT INTO user_info_data SELECT i, ('test', 0)::user_data FROM generate_series(0,7)i; @@ -76,10 +76,24 @@ execute fast_path_router_with_param_and_func(5); execute fast_path_router_with_param_and_func(6); execute fast_path_router_with_param_and_func(7); +INSERT INTO user_info_data SELECT 1, ('test', 0)::user_data, i FROM generate_series(0,7)i; + +PREPARE fast_path_router_with_param_and_func_on_non_dist_key(int) AS + DELETE FROM user_info_data WHERE user_id = 1 AND user_index = $1 AND u_data = ('test', get_local_node_id_stable())::user_data RETURNING *; + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(0); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(1); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(2); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(3); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(4); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(5); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(6); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(7); + INSERT INTO user_info_data SELECT 1, ('test' || i, 0)::user_data FROM generate_series(0,7)i; -PREPARE fast_path_router_with_param_on_non_dist_key_and_func(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 1 RETURNING *; +PREPARE fast_path_router_with_param_on_non_dist_key_and_func(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 1 RETURNING user_id, u_data; EXECUTE fast_path_router_with_param_on_non_dist_key_and_func(('test0', get_local_node_id_stable())::user_data); EXECUTE fast_path_router_with_param_on_non_dist_key_and_func(('test1', get_local_node_id_stable())::user_data); EXECUTE fast_path_router_with_param_on_non_dist_key_and_func(('test2', get_local_node_id_stable())::user_data); @@ -93,7 +107,7 @@ EXECUTE fast_path_router_with_param_on_non_dist_key_and_func(('test7', get_local INSERT INTO user_info_data SELECT 1, ('test', i)::user_data FROM generate_series(0,7)i; PREPARE fast_path_router_with_param_on_non_dist_key(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 1 RETURNING - *; + user_id, u_data; EXECUTE fast_path_router_with_param_on_non_dist_key(('test', 0)::user_data); EXECUTE fast_path_router_with_param_on_non_dist_key(('test', 1)::user_data); EXECUTE fast_path_router_with_param_on_non_dist_key(('test', 2)::user_data); @@ -107,7 +121,7 @@ EXECUTE fast_path_router_with_param_on_non_dist_key(('test', 7)::user_data); INSERT INTO user_info_data SELECT i, ('test', i)::user_data FROM generate_series(0,7)i; PREPARE fast_path_router_with_two_params(user_data, int) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = $2 RETURNING - *; + user_id, u_data; EXECUTE fast_path_router_with_two_params(('test', 0)::user_data, 0); EXECUTE fast_path_router_with_two_params(('test', 1)::user_data, 1); @@ -121,7 +135,7 @@ EXECUTE fast_path_router_with_two_params(('test', 7)::user_data, 7); INSERT INTO user_info_data VALUES(1, ('test', 1)::user_data); -PREPARE fast_path_router_with_only_function AS DELETE FROM user_info_data WHERE get_local_node_id_stable() = 0 AND user_id = 1 RETURNING *; +PREPARE fast_path_router_with_only_function AS DELETE FROM user_info_data WHERE get_local_node_id_stable() = 0 AND user_id = 1 RETURNING user_id, u_data; EXECUTE fast_path_router_with_only_function; INSERT INTO user_info_data VALUES(1, ('test', 1)::user_data); EXECUTE fast_path_router_with_only_function; @@ -138,8 +152,6 @@ EXECUTE fast_path_router_with_only_function; INSERT INTO user_info_data VALUES(1, ('test', 1)::user_data); EXECUTE fast_path_router_with_only_function; -ALTER TABLE user_info_data ADD COLUMN user_index INT; - PREPARE insert_with_function_and_param(user_data) AS INSERT INTO user_info_data VALUES (1, $1, get_local_node_id_stable()) RETURNING user_id; EXECUTE insert_with_function_and_param(('test', 1)::user_data); EXECUTE insert_with_function_and_param(('test', 1)::user_data); @@ -149,13 +161,12 @@ EXECUTE insert_with_function_and_param(('test', 1)::user_data); EXECUTE insert_with_function_and_param(('test', 1)::user_data); EXECUTE insert_with_function_and_param(('test', 1)::user_data); -ALTER TABLE user_info_data DROP COLUMN user_index; TRUNCATE user_info_data; INSERT INTO user_info_data SELECT i, ('test', i)::user_data FROM generate_series(0,7)i; -- make sure that it is also true for non fast-path router queries with paramaters -PREPARE router_with_param(int) AS DELETE FROM user_info_data WHERE user_id = $1 AND user_id = $1 RETURNING *; +PREPARE router_with_param(int) AS DELETE FROM user_info_data WHERE user_id = $1 AND user_id = $1 RETURNING user_id, u_data; execute router_with_param(0); execute router_with_param(1); @@ -168,7 +179,7 @@ execute router_with_param(7); -- make sure that it is also true for non fast-path router queries with paramaters -PREPARE router_with_param_and_func(int) AS DELETE FROM user_info_data WHERE u_data = ('test', get_local_node_id_stable())::user_data AND user_id = $1 AND user_id = $1 RETURNING *; +PREPARE router_with_param_and_func(int) AS DELETE FROM user_info_data WHERE u_data = ('test', get_local_node_id_stable())::user_data AND user_id = $1 AND user_id = $1 RETURNING user_id, u_data; INSERT INTO user_info_data SELECT i, ('test', 0)::user_data FROM generate_series(0,7)i; @@ -181,10 +192,24 @@ execute router_with_param_and_func(5); execute router_with_param_and_func(6); execute router_with_param_and_func(7); +INSERT INTO user_info_data SELECT 1, ('test', 0)::user_data, i FROM generate_series(0,7)i; + +PREPARE router_with_param_and_func_on_non_dist_key(int) AS + DELETE FROM user_info_data WHERE user_id = 1 AND user_id = 1 AND user_index = $1 AND u_data = ('test', get_local_node_id_stable())::user_data RETURNING *; + +EXECUTE router_with_param_and_func_on_non_dist_key(0); +EXECUTE router_with_param_and_func_on_non_dist_key(1); +EXECUTE router_with_param_and_func_on_non_dist_key(2); +EXECUTE router_with_param_and_func_on_non_dist_key(3); +EXECUTE router_with_param_and_func_on_non_dist_key(4); +EXECUTE router_with_param_and_func_on_non_dist_key(5); +EXECUTE router_with_param_and_func_on_non_dist_key(6); +EXECUTE router_with_param_and_func_on_non_dist_key(7); + INSERT INTO user_info_data SELECT 1, ('test' || i, 0)::user_data FROM generate_series(0,7)i; -PREPARE router_with_param_on_non_dist_key_and_func(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 1 AND user_id = 1 RETURNING *; +PREPARE router_with_param_on_non_dist_key_and_func(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 1 AND user_id = 1 RETURNING user_id, u_data; EXECUTE router_with_param_on_non_dist_key_and_func(('test0', get_local_node_id_stable())::user_data); EXECUTE router_with_param_on_non_dist_key_and_func(('test1', get_local_node_id_stable())::user_data); EXECUTE router_with_param_on_non_dist_key_and_func(('test2', get_local_node_id_stable())::user_data); @@ -197,7 +222,7 @@ EXECUTE router_with_param_on_non_dist_key_and_func(('test7', get_local_node_id_s INSERT INTO user_info_data SELECT 1, ('test', i)::user_data FROM generate_series(0,7)i; -PREPARE router_with_param_on_non_dist_key(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 1 AND user_id = 1 RETURNING *; +PREPARE router_with_param_on_non_dist_key(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 1 AND user_id = 1 RETURNING user_id, u_data; EXECUTE router_with_param_on_non_dist_key(('test', 0)::user_data); EXECUTE router_with_param_on_non_dist_key(('test', 1)::user_data); EXECUTE router_with_param_on_non_dist_key(('test', 2)::user_data); @@ -212,7 +237,7 @@ EXECUTE router_with_param_on_non_dist_key(('test', 7)::user_data); INSERT INTO user_info_data SELECT i, ('test', i)::user_data FROM generate_series(0,7)i; PREPARE router_with_two_params(user_data, int) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = $2 AND user_id = $2 RETURNING - *; + user_id, u_data; EXECUTE router_with_two_params(('test', 0)::user_data, 0); EXECUTE router_with_two_params(('test', 1)::user_data, 1); @@ -225,7 +250,7 @@ EXECUTE router_with_two_params(('test', 7)::user_data, 7); INSERT INTO user_info_data VALUES(1, ('test', 1)::user_data); -PREPARE router_with_only_function AS DELETE FROM user_info_data WHERE get_local_node_id_stable() = 0 AND user_id = 1 AND user_id = 1 RETURNING *; +PREPARE router_with_only_function AS DELETE FROM user_info_data WHERE get_local_node_id_stable() = 0 AND user_id = 1 AND user_id = 1 RETURNING user_id, u_data; EXECUTE router_with_only_function; INSERT INTO user_info_data VALUES(1, ('test', 1)::user_data); EXECUTE router_with_only_function; @@ -263,7 +288,7 @@ INSERT INTO user_info_data (user_id, u_data) VALUES -- make sure that it is also true for fast-path router queries with paramaters -PREPARE fast_path_router_with_param(int) AS DELETE FROM user_info_data WHERE user_id = $1 RETURNING *; +PREPARE fast_path_router_with_param(int) AS DELETE FROM user_info_data WHERE user_id = $1 RETURNING user_id, u_data; execute fast_path_router_with_param(3); execute fast_path_router_with_param(4); @@ -281,7 +306,7 @@ INSERT INTO user_info_data (user_id, u_data) VALUES (14, '(''test'', 2)'), (16, '(''test'', 2)'); -- make sure that it is also true for fast-path router queries with paramaters -PREPARE fast_path_router_with_param_and_func(int) AS DELETE FROM user_info_data WHERE u_data = ('''test''', get_constant_stable())::user_data AND user_id = $1 RETURNING *; +PREPARE fast_path_router_with_param_and_func(int) AS DELETE FROM user_info_data WHERE u_data = ('''test''', get_constant_stable())::user_data AND user_id = $1 RETURNING user_id, u_data; execute fast_path_router_with_param_and_func(3); execute fast_path_router_with_param_and_func(4); @@ -292,7 +317,22 @@ execute fast_path_router_with_param_and_func(12); execute fast_path_router_with_param_and_func(14); execute fast_path_router_with_param_and_func(16); -PREPARE fast_path_router_with_param_on_non_dist_key_and_func(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 3 RETURNING *; + +INSERT INTO user_info_data SELECT 3, ('test', get_local_node_id_stable() > 0)::user_data, i FROM generate_series(0,7)i; + +PREPARE fast_path_router_with_param_and_func_on_non_dist_key(int) AS + DELETE FROM user_info_data WHERE user_id = 3 AND user_index = $1 AND u_data = ('test', (get_local_node_id_stable() > 0)::int)::user_data RETURNING user_id, user_index; + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(0); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(1); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(2); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(3); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(4); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(5); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(6); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(7); + +PREPARE fast_path_router_with_param_on_non_dist_key_and_func(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 3 RETURNING user_id, u_data; INSERT INTO user_info_data (user_id, u_data) VALUES (3, '(''test'', 2)'::user_data); EXECUTE fast_path_router_with_param_on_non_dist_key_and_func(('''test''', get_constant_stable())::user_data); INSERT INTO user_info_data (user_id, u_data) VALUES (3, '(''test'', 2)'); @@ -311,7 +351,7 @@ EXECUTE fast_path_router_with_param_on_non_dist_key_and_func(('''test''', get_co -PREPARE fast_path_router_with_param_on_non_dist_key(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 3 RETURNING *; +PREPARE fast_path_router_with_param_on_non_dist_key(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 3 RETURNING user_id, u_data; INSERT INTO user_info_data (user_id, u_data) VALUES (3, ('test', 1)::user_data); EXECUTE fast_path_router_with_param_on_non_dist_key(('test', 1)::user_data); INSERT INTO user_info_data (user_id, u_data) VALUES (3, ('test', 1)::user_data); @@ -334,7 +374,7 @@ INSERT INTO user_info_data (user_id, u_data) VALUES (9, ('test', 2)), (11, ('test', 2)), (12, ('test', 2)), (14, ('test', 2)), (16, ('test', 2)); -PREPARE fast_path_router_with_two_params(user_data, int) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = $2 RETURNING *; +PREPARE fast_path_router_with_two_params(user_data, int) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = $2 RETURNING user_id, u_data; EXECUTE fast_path_router_with_two_params(('test', 2)::user_data, 3); EXECUTE fast_path_router_with_two_params(('test', 2)::user_data, 4); @@ -346,7 +386,7 @@ EXECUTE fast_path_router_with_two_params(('test', 2)::user_data, 14); EXECUTE fast_path_router_with_two_params(('test', 2)::user_data, 16); -PREPARE fast_path_router_with_only_function AS DELETE FROM user_info_data WHERE get_constant_stable() = 2AND user_id = 3 RETURNING *; +PREPARE fast_path_router_with_only_function AS DELETE FROM user_info_data WHERE get_constant_stable() = 2AND user_id = 3 RETURNING user_id, u_data; INSERT INTO user_info_data (user_id, u_data) VALUES (3, ('test', 2)::user_data); EXECUTE fast_path_router_with_only_function; INSERT INTO user_info_data (user_id, u_data) VALUES (3, ('test', 2)::user_data); @@ -363,15 +403,7 @@ INSERT INTO user_info_data (user_id, u_data) VALUES (3, ('test', 2)::user_data) EXECUTE fast_path_router_with_only_function; -------- -\c - - - :master_port -SET search_path TO master_evaluation_combinations_modify; -ALTER TABLE user_info_data ADD COLUMN user_index INT; - -\c - - - :worker_2_port -SET search_path TO master_evaluation_combinations_modify; - -PREPARE insert_with_function_and_param(user_data) AS INSERT INTO user_info_data VALUES (3, $1, get_local_node_id_stable()) RETURNING user_id; +PREPARE insert_with_function_and_param(user_data) AS INSERT INTO user_info_data VALUES (3, $1, (get_local_node_id_stable() > 0)::int) RETURNING user_id; EXECUTE insert_with_function_and_param(('test', 1)::user_data); EXECUTE insert_with_function_and_param(('test', 1)::user_data); EXECUTE insert_with_function_and_param(('test', 1)::user_data); @@ -380,16 +412,8 @@ EXECUTE insert_with_function_and_param(('test', 1)::user_data); EXECUTE insert_with_function_and_param(('test', 1)::user_data); EXECUTE insert_with_function_and_param(('test', 1)::user_data); -\c - - - :master_port -SET search_path TO master_evaluation_combinations_modify; -ALTER TABLE user_info_data DROP COLUMN user_index; TRUNCATE user_info_data; - -\c - - - :worker_2_port -SET citus.log_local_commands TO ON; -SET search_path TO master_evaluation_combinations_modify; - -- all local values INSERT INTO user_info_data (user_id, u_data) VALUES (3, '(''test3'', 3)'), (4, '(''test4'', 4)'), (7, '(''test7'', 7)'), @@ -397,7 +421,7 @@ INSERT INTO user_info_data (user_id, u_data) VALUES (14, '(''test14'', 14)'), (16, '(''test16'', 16)'); -- make sure that it is also true for fast-path router queries with paramaters -PREPARE router_with_param(int) AS DELETE FROM user_info_data WHERE user_id = $1 AND user_id = $1 RETURNING *; +PREPARE router_with_param(int) AS DELETE FROM user_info_data WHERE user_id = $1 AND user_id = $1 RETURNING user_id, u_data; execute router_with_param(3); execute router_with_param(4); @@ -415,7 +439,7 @@ INSERT INTO user_info_data (user_id, u_data) VALUES (14, '(''test'', 2)'), (16, '(''test'', 2)'); -- make sure that it is also true for fast-path router queries with paramaters -PREPARE router_with_param_and_func(int) AS DELETE FROM user_info_data WHERE u_data = ('''test''', get_constant_stable())::user_data AND user_id = $1 AND user_id = $1 RETURNING *; +PREPARE router_with_param_and_func(int) AS DELETE FROM user_info_data WHERE u_data = ('''test''', get_constant_stable())::user_data AND user_id = $1 AND user_id = $1 RETURNING user_id, u_data; execute router_with_param_and_func(3); execute router_with_param_and_func(4); @@ -426,7 +450,22 @@ execute router_with_param_and_func(12); execute router_with_param_and_func(14); execute router_with_param_and_func(16); -PREPARE router_with_param_on_non_dist_key_and_func(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 3 AND user_id = 3 RETURNING *; + +INSERT INTO user_info_data SELECT 3, ('test', get_local_node_id_stable() > 0)::user_data, i FROM generate_series(0,7)i; + +PREPARE router_with_param_and_func_on_non_dist_key(int) AS + DELETE FROM user_info_data WHERE user_id = 3 AND user_id = 3 AND user_index = $1 AND u_data = ('test', (get_local_node_id_stable() > 0)::int)::user_data RETURNING user_id, user_index; + +EXECUTE router_with_param_and_func_on_non_dist_key(0); +EXECUTE router_with_param_and_func_on_non_dist_key(1); +EXECUTE router_with_param_and_func_on_non_dist_key(2); +EXECUTE router_with_param_and_func_on_non_dist_key(3); +EXECUTE router_with_param_and_func_on_non_dist_key(4); +EXECUTE router_with_param_and_func_on_non_dist_key(5); +EXECUTE router_with_param_and_func_on_non_dist_key(6); +EXECUTE router_with_param_and_func_on_non_dist_key(7); + +PREPARE router_with_param_on_non_dist_key_and_func(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 3 AND user_id = 3 RETURNING user_id, u_data; INSERT INTO user_info_data (user_id, u_data) VALUES (3, '(''test'', 2)'::user_data); EXECUTE router_with_param_on_non_dist_key_and_func(('''test''', get_constant_stable())::user_data); INSERT INTO user_info_data (user_id, u_data) VALUES (3, '(''test'', 2)'); @@ -445,7 +484,7 @@ EXECUTE router_with_param_on_non_dist_key_and_func(('''test''', get_constant_sta -PREPARE router_with_param_on_non_dist_key(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 3 AND user_id = 3 RETURNING *; +PREPARE router_with_param_on_non_dist_key(user_data) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = 3 AND user_id = 3 RETURNING user_id, u_data; INSERT INTO user_info_data (user_id, u_data) VALUES (3, ('test', 1)::user_data); EXECUTE router_with_param_on_non_dist_key(('test', 1)::user_data); INSERT INTO user_info_data (user_id, u_data) VALUES (3, ('test', 1)::user_data); @@ -468,7 +507,7 @@ INSERT INTO user_info_data (user_id, u_data) VALUES (9, ('test', 2)), (11, ('test', 2)), (12, ('test', 2)), (14, ('test', 2)), (16, ('test', 2)); -PREPARE router_with_two_params(user_data, int) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = $2 AND user_id = $2 RETURNING *; +PREPARE router_with_two_params(user_data, int) AS DELETE FROM user_info_data WHERE u_data = $1 AND user_id = $2 AND user_id = $2 RETURNING user_id, u_data; EXECUTE router_with_two_params(('test', 2)::user_data, 3); EXECUTE router_with_two_params(('test', 2)::user_data, 4); @@ -480,7 +519,7 @@ EXECUTE router_with_two_params(('test', 2)::user_data, 14); EXECUTE router_with_two_params(('test', 2)::user_data, 16); -PREPARE router_with_only_function AS DELETE FROM user_info_data WHERE get_constant_stable() = 2AND user_id = 3 RETURNING *; +PREPARE router_with_only_function AS DELETE FROM user_info_data WHERE get_constant_stable() = 2AND user_id = 3 RETURNING user_id, u_data; INSERT INTO user_info_data (user_id, u_data) VALUES (3, ('test', 2)::user_data); EXECUTE router_with_only_function; INSERT INTO user_info_data (user_id, u_data) VALUES (3, ('test', 2)::user_data); diff --git a/src/test/regress/sql/master_evaluation_select.sql b/src/test/regress/sql/master_evaluation_select.sql index 2ea2036d2..575e22c39 100644 --- a/src/test/regress/sql/master_evaluation_select.sql +++ b/src/test/regress/sql/master_evaluation_select.sql @@ -32,14 +32,14 @@ CREATE TYPE user_data AS (name text, age int); SET citus.replication_model TO streaming; SET citus.shard_replication_factor TO 1; -CREATE TABLE user_info_data (user_id int, u_data user_data); +CREATE TABLE user_info_data (user_id int, u_data user_data, user_index int); SELECT create_distributed_table('user_info_data', 'user_id'); -- show that local id is 0, we'll use this information SELECT get_local_node_id_volatile(); -- load data -INSERT INTO user_info_data SELECT i, ('name' || i, i % 20 + 20)::user_data FROM generate_series(0,100)i; +INSERT INTO user_info_data SELECT i, ('name' || i, i % 20 + 20)::user_data, i FROM generate_series(0,100)i; -- we expect that the function is evaluated on the worker node, so we should get a row SELECT get_local_node_id_volatile() > 0 FROM user_info_data WHERE user_id = 1; @@ -72,6 +72,17 @@ execute fast_path_router_with_param_and_func(6); execute fast_path_router_with_param_and_func(7); execute fast_path_router_with_param_and_func(8); +PREPARE fast_path_router_with_param_and_func_on_non_dist_key(int) AS + SELECT get_local_node_id_volatile() > 0 FROM user_info_data WHERE user_id = 1 AND user_index = $1; + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(1); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(1); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(1); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(1); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(1); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(1); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(1); + SELECT get_local_node_id_volatile() > 0 FROM user_info_data WHERE user_id = 1 AND u_data = ('name1', 21)::user_data; @@ -152,6 +163,17 @@ execute router_with_param_and_func(6); execute router_with_param_and_func(7); execute router_with_param_and_func(8); +PREPARE router_with_param_and_func_on_non_dist_key(int) AS + SELECT get_local_node_id_volatile() > 0 FROM user_info_data WHERE user_id = 1 AND user_id = 1 AND user_index = $1; + +EXECUTE router_with_param_and_func_on_non_dist_key(1); +EXECUTE router_with_param_and_func_on_non_dist_key(1); +EXECUTE router_with_param_and_func_on_non_dist_key(1); +EXECUTE router_with_param_and_func_on_non_dist_key(1); +EXECUTE router_with_param_and_func_on_non_dist_key(1); +EXECUTE router_with_param_and_func_on_non_dist_key(1); +EXECUTE router_with_param_and_func_on_non_dist_key(1); + -- same query as router_with_param, but with consts SELECT get_local_node_id_volatile() > 0 FROM user_info_data m1 JOIN user_info_data m2 USING(user_id) WHERE m1.user_id = 1; @@ -242,6 +264,18 @@ execute fast_path_router_with_param_and_func(3); execute fast_path_router_with_param_and_func(3); execute fast_path_router_with_param_and_func(8); + +PREPARE fast_path_router_with_param_and_func_on_non_dist_key(int) AS + SELECT get_local_node_id_volatile() > 0 FROM user_info_data WHERE user_id = 3 AND user_index = $1; + +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(3); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(3); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(3); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(3); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(3); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(3); +EXECUTE fast_path_router_with_param_and_func_on_non_dist_key(3); + SELECT get_local_node_id_volatile() > 0 FROM user_info_data WHERE user_id = 3 AND u_data = ('name3', 23)::user_data; PREPARE fast_path_router_with_param_on_non_dist_key_and_func(user_data) AS SELECT get_local_node_id_volatile() > 0 FROM user_info_data WHERE user_id = 3 AND u_data = $1; @@ -308,6 +342,18 @@ execute router_with_param_and_func(3); execute router_with_param_and_func(3); execute router_with_param_and_func(3); +PREPARE router_with_param_and_func_on_non_dist_key(int) AS + SELECT get_local_node_id_volatile() > 0 FROM user_info_data WHERE user_id = 3 AND user_id = 3 AND user_index = $1; + +EXECUTE router_with_param_and_func_on_non_dist_key(3); +EXECUTE router_with_param_and_func_on_non_dist_key(3); +EXECUTE router_with_param_and_func_on_non_dist_key(3); +EXECUTE router_with_param_and_func_on_non_dist_key(3); +EXECUTE router_with_param_and_func_on_non_dist_key(3); +EXECUTE router_with_param_and_func_on_non_dist_key(3); +EXECUTE router_with_param_and_func_on_non_dist_key(3); + + -- same query as router_with_param, but with consts SELECT get_local_node_id_volatile() > 0 FROM user_info_data m1 JOIN user_info_data m2 USING(user_id) WHERE m1.user_id = 3;