mirror of https://github.com/citusdata/citus.git
Fix check_multi tests
parent
8901936e9a
commit
6de2d7f050
|
@ -875,6 +875,7 @@ BEGIN
|
|||
RETURN $1 * $1;
|
||||
END;
|
||||
$function$;
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION square_func(int)
|
||||
RETURNS int
|
||||
LANGUAGE plpgsql
|
||||
|
@ -883,6 +884,7 @@ BEGIN
|
|||
RETURN $1 * $1;
|
||||
END;
|
||||
$function$;
|
||||
RESET citus.enable_metadata_sync;
|
||||
SELECT const_function(1), string_agg(a::character, ',') FROM t1;
|
||||
NOTICE: stable_fn called
|
||||
CONTEXT: PL/pgSQL function const_function(integer) line XX at RAISE
|
||||
|
|
|
@ -303,16 +303,12 @@ BEGIN
|
|||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
SELECT create_distributed_function('func_calls_forcepush_func()');
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands
|
||||
create_distributed_function
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT create_distributed_function('inner_force_delegation_function(int)', '$1', colocate_with := 'test_nested', force_delegation := true);
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands
|
||||
create_distributed_function
|
||||
---------------------------------------------------------------------
|
||||
|
||||
|
@ -367,6 +363,7 @@ $$ LANGUAGE plpgsql;
|
|||
-- select res into var from fn();
|
||||
-- }
|
||||
--
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION func_calls_forcepush_func_infrom()
|
||||
RETURNS NUMERIC AS $$
|
||||
DECLARE incremented_val NUMERIC;
|
||||
|
@ -377,6 +374,7 @@ BEGIN
|
|||
RETURN incremented_val;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
SELECT func_calls_forcepush_func_infrom();
|
||||
DEBUG: pushing down function call in a multi-statement transaction
|
||||
CONTEXT: SQL statement "SELECT inner_force_delegation_function FROM inner_force_delegation_function(add_val + 100)"
|
||||
|
@ -418,6 +416,7 @@ COMMIT;
|
|||
-- select fn() into var;
|
||||
-- }
|
||||
--
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION func_calls_forcepush_func_intarget()
|
||||
RETURNS NUMERIC AS $$
|
||||
DECLARE incremented_val NUMERIC;
|
||||
|
@ -428,6 +427,7 @@ BEGIN
|
|||
RETURN incremented_val;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
SELECT func_calls_forcepush_func_intarget();
|
||||
DEBUG: pushing down function call in a multi-statement transaction
|
||||
CONTEXT: SQL statement "SELECT inner_force_delegation_function(100 + 100) OFFSET 0"
|
||||
|
@ -474,8 +474,6 @@ BEGIN
|
|||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
SELECT create_distributed_function('test_recursive(int)', '$1', colocate_with := 'test_nested', force_delegation := true);
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands
|
||||
create_distributed_function
|
||||
---------------------------------------------------------------------
|
||||
|
||||
|
@ -549,8 +547,6 @@ SELECT create_distributed_function(
|
|||
'$1',
|
||||
colocate_with := 'test_forcepushdown',
|
||||
force_delegation := true);
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands
|
||||
create_distributed_function
|
||||
---------------------------------------------------------------------
|
||||
|
||||
|
@ -610,6 +606,7 @@ BEGIN
|
|||
INSERT INTO emp VALUES (empname, 33);
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION outer_emp()
|
||||
RETURNS void
|
||||
AS $$
|
||||
|
@ -618,9 +615,8 @@ BEGIN
|
|||
PERFORM inner_emp('hello');
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
SELECT create_distributed_function('inner_emp(text)','empname', force_delegation := true);
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands
|
||||
create_distributed_function
|
||||
---------------------------------------------------------------------
|
||||
|
||||
|
@ -655,8 +651,6 @@ SELECT create_distributed_function(
|
|||
colocate_with := 'test_forcepushdown',
|
||||
force_delegation := true
|
||||
);
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands
|
||||
create_distributed_function
|
||||
---------------------------------------------------------------------
|
||||
|
||||
|
@ -730,8 +724,6 @@ SELECT create_distributed_function(
|
|||
colocate_with := 'test_forcepushdown',
|
||||
force_delegation := true
|
||||
);
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands
|
||||
create_distributed_function
|
||||
---------------------------------------------------------------------
|
||||
|
||||
|
@ -808,8 +800,6 @@ SELECT create_distributed_function(
|
|||
colocate_with := 'test_forcepushdown_char',
|
||||
force_delegation := true
|
||||
);
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands
|
||||
create_distributed_function
|
||||
---------------------------------------------------------------------
|
||||
|
||||
|
@ -826,8 +816,6 @@ SELECT create_distributed_function(
|
|||
colocate_with := 'test_forcepushdown_varchar',
|
||||
force_delegation := true
|
||||
);
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands
|
||||
create_distributed_function
|
||||
---------------------------------------------------------------------
|
||||
|
||||
|
@ -844,8 +832,6 @@ SELECT create_distributed_function(
|
|||
colocate_with := 'test_forcepushdown_text',
|
||||
force_delegation := true
|
||||
);
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands
|
||||
create_distributed_function
|
||||
---------------------------------------------------------------------
|
||||
|
||||
|
@ -952,8 +938,6 @@ SELECT create_distributed_function(
|
|||
colocate_with := 'test_subquery',
|
||||
force_delegation := true
|
||||
);
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands
|
||||
create_distributed_function
|
||||
---------------------------------------------------------------------
|
||||
|
||||
|
@ -974,8 +958,6 @@ SELECT create_distributed_function(
|
|||
colocate_with := 'test_subquery',
|
||||
force_delegation := true
|
||||
);
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands
|
||||
create_distributed_function
|
||||
---------------------------------------------------------------------
|
||||
|
||||
|
@ -995,8 +977,6 @@ SELECT create_distributed_function(
|
|||
colocate_with := 'test_subquery',
|
||||
force_delegation := true
|
||||
);
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands
|
||||
create_distributed_function
|
||||
---------------------------------------------------------------------
|
||||
|
||||
|
@ -1016,8 +996,6 @@ SELECT create_distributed_function(
|
|||
colocate_with := 'test_subquery',
|
||||
force_delegation := true
|
||||
);
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands
|
||||
create_distributed_function
|
||||
---------------------------------------------------------------------
|
||||
|
||||
|
@ -1038,8 +1016,6 @@ SELECT create_distributed_function(
|
|||
colocate_with := 'test_subquery',
|
||||
force_delegation := true
|
||||
);
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands
|
||||
create_distributed_function
|
||||
---------------------------------------------------------------------
|
||||
|
||||
|
@ -1211,8 +1187,6 @@ BEGIN
|
|||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
SELECT create_distributed_function('test_prepare(int,int)','x',force_delegation :=true, colocate_with := 'table_test_prepare');
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands
|
||||
create_distributed_function
|
||||
---------------------------------------------------------------------
|
||||
|
||||
|
@ -1220,6 +1194,7 @@ DETAIL: A distributed function is created. To make sure subsequent commands see
|
|||
|
||||
DROP FUNCTION outer_test_prepare(int, int);
|
||||
ERROR: function outer_test_prepare(integer, integer) does not exist
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION outer_test_prepare(x int, y int)
|
||||
RETURNS void
|
||||
AS $$
|
||||
|
@ -1230,6 +1205,7 @@ BEGIN
|
|||
PERFORM 1, 1 + a FROM test_prepare(x + 1, y + 1) a;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
-- First 5 get delegated and succeeds
|
||||
BEGIN;
|
||||
SELECT outer_test_prepare(1,1);
|
||||
|
@ -1406,8 +1382,6 @@ END;
|
|||
$$ LANGUAGE plpgsql;
|
||||
SELECT create_distributed_function('test(int)', 'x',
|
||||
colocate_with := 'test_perform', force_delegation := true);
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands
|
||||
create_distributed_function
|
||||
---------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -40,8 +40,6 @@ CREATE FUNCTION add(integer, integer) RETURNS integer
|
|||
AS 'SELECT $1 + $2;'
|
||||
LANGUAGE SQL;
|
||||
SELECT create_distributed_function('add(integer,integer)');
|
||||
DEBUG: switching to sequential query execution mode
|
||||
DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands
|
||||
create_distributed_function
|
||||
---------------------------------------------------------------------
|
||||
|
||||
|
@ -198,6 +196,7 @@ SET client_min_messages TO ERROR;
|
|||
-- function joins in CTE results can create lateral joins that are not supported
|
||||
-- we execute the query within a function to consolidate the error messages
|
||||
-- between different executors
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE FUNCTION raise_failed_execution_func_join(query text) RETURNS void AS $$
|
||||
BEGIN
|
||||
EXECUTE query;
|
||||
|
@ -209,6 +208,7 @@ BEGIN
|
|||
END IF;
|
||||
END;
|
||||
$$LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
SELECT raise_failed_execution_func_join($$
|
||||
WITH one_row AS (
|
||||
SELECT * FROM table1 WHERE id=52
|
||||
|
|
|
@ -200,6 +200,7 @@ SET client_min_messages TO ERROR;
|
|||
-- function joins in CTE results can create lateral joins that are not supported
|
||||
-- we execute the query within a function to consolidate the error messages
|
||||
-- between different executors
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE FUNCTION raise_failed_execution_func_join(query text) RETURNS void AS $$
|
||||
BEGIN
|
||||
EXECUTE query;
|
||||
|
@ -211,6 +212,7 @@ BEGIN
|
|||
END IF;
|
||||
END;
|
||||
$$LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
SELECT raise_failed_execution_func_join($$
|
||||
WITH one_row AS (
|
||||
SELECT * FROM table1 WHERE id=52
|
||||
|
|
|
@ -1132,10 +1132,6 @@ DROP TABLE http_request;
|
|||
-- (re-)planning, but not when executing.
|
||||
-- first create helper function
|
||||
CREATE OR REPLACE FUNCTION immutable_bleat(text) RETURNS int LANGUAGE plpgsql IMMUTABLE AS $$BEGIN RAISE NOTICE '%', $1;RETURN 1;END$$;
|
||||
\c - - - :worker_1_port
|
||||
CREATE OR REPLACE FUNCTION immutable_bleat(text) RETURNS int LANGUAGE plpgsql IMMUTABLE AS $$BEGIN RAISE NOTICE '%', $1;RETURN 1;END$$;
|
||||
\c - - - :worker_2_port
|
||||
CREATE OR REPLACE FUNCTION immutable_bleat(text) RETURNS int LANGUAGE plpgsql IMMUTABLE AS $$BEGIN RAISE NOTICE '%', $1;RETURN 1;END$$;
|
||||
\c - - - :master_port
|
||||
-- test table
|
||||
CREATE TABLE test_table (test_id integer NOT NULL, data text);
|
||||
|
|
|
@ -1563,22 +1563,8 @@ LIMIT 10;
|
|||
(10 rows)
|
||||
|
||||
-- this is one complex join query derived from a user's production query
|
||||
-- first declare the function on workers on master
|
||||
-- declare the function on workers and master
|
||||
-- With array_index:
|
||||
SELECT * FROM run_command_on_workers('CREATE OR REPLACE FUNCTION array_index(ANYARRAY, ANYELEMENT)
|
||||
RETURNS INT AS $$
|
||||
SELECT i
|
||||
FROM (SELECT generate_series(array_lower($1, 1), array_upper($1, 1))) g(i)
|
||||
WHERE $1 [i] = $2
|
||||
LIMIT 1;
|
||||
$$ LANGUAGE sql')
|
||||
ORDER BY 1,2;
|
||||
nodename | nodeport | success | result
|
||||
---------------------------------------------------------------------
|
||||
localhost | 57637 | t | CREATE FUNCTION
|
||||
localhost | 57638 | t | CREATE FUNCTION
|
||||
(2 rows)
|
||||
|
||||
CREATE OR REPLACE FUNCTION array_index(ANYARRAY, ANYELEMENT)
|
||||
RETURNS INT AS $$
|
||||
SELECT i
|
||||
|
@ -1745,14 +1731,6 @@ LIMIT 10;
|
|||
(10 rows)
|
||||
|
||||
-- drop created functions
|
||||
SELECT * FROM run_command_on_workers('DROP FUNCTION array_index(ANYARRAY, ANYELEMENT)')
|
||||
ORDER BY 1,2;
|
||||
nodename | nodeport | success | result
|
||||
---------------------------------------------------------------------
|
||||
localhost | 57637 | t | DROP FUNCTION
|
||||
localhost | 57638 | t | DROP FUNCTION
|
||||
(2 rows)
|
||||
|
||||
DROP FUNCTION array_index(ANYARRAY, ANYELEMENT);
|
||||
-- a query with a constant subquery
|
||||
SELECT count(*) as subquery_count
|
||||
|
@ -1987,21 +1965,6 @@ CREATE FUNCTION test_join_function_2(integer, integer) RETURNS bool
|
|||
LANGUAGE SQL
|
||||
IMMUTABLE
|
||||
RETURNS NULL ON NULL INPUT;
|
||||
SELECT run_command_on_workers($f$
|
||||
|
||||
CREATE FUNCTION test_join_function_2(integer, integer) RETURNS bool
|
||||
AS 'select $1 > $2;'
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE
|
||||
RETURNS NULL ON NULL INPUT;
|
||||
|
||||
$f$);
|
||||
run_command_on_workers
|
||||
---------------------------------------------------------------------
|
||||
(localhost,57637,t,"CREATE FUNCTION")
|
||||
(localhost,57638,t,"CREATE FUNCTION")
|
||||
(2 rows)
|
||||
|
||||
-- we don't support joins via functions
|
||||
SELECT user_id, array_length(events_table, 1)
|
||||
FROM (
|
||||
|
@ -2285,16 +2248,5 @@ LIMIT 1;
|
|||
(1 row)
|
||||
|
||||
DROP FUNCTION test_join_function_2(integer, integer);
|
||||
SELECT run_command_on_workers($f$
|
||||
|
||||
DROP FUNCTION test_join_function_2(integer, integer);
|
||||
|
||||
$f$);
|
||||
run_command_on_workers
|
||||
---------------------------------------------------------------------
|
||||
(localhost,57637,t,"DROP FUNCTION")
|
||||
(localhost,57638,t,"DROP FUNCTION")
|
||||
(2 rows)
|
||||
|
||||
SET citus.enable_router_execution TO TRUE;
|
||||
SET citus.subquery_pushdown to OFF;
|
||||
|
|
|
@ -20,6 +20,7 @@ SET citus.enable_repartition_joins TO ON;
|
|||
-- copied from multi_explain.sql and had to give
|
||||
-- a different name via postfix to prevent concurrent
|
||||
-- create/drop etc.
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION explain_json_2(query text)
|
||||
RETURNS jsonb
|
||||
AS $BODY$
|
||||
|
@ -30,6 +31,7 @@ BEGIN
|
|||
RETURN result;
|
||||
END;
|
||||
$BODY$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
-- leaf queries contain colocated joins
|
||||
-- but not the subquery
|
||||
SELECT true AS valid FROM explain_json_2($$
|
||||
|
|
|
@ -459,6 +459,7 @@ RETURN $1 * $1;
|
|||
END;
|
||||
$function$;
|
||||
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION square_func(int)
|
||||
RETURNS int
|
||||
LANGUAGE plpgsql
|
||||
|
@ -467,6 +468,7 @@ BEGIN
|
|||
RETURN $1 * $1;
|
||||
END;
|
||||
$function$;
|
||||
RESET citus.enable_metadata_sync;
|
||||
|
||||
SELECT const_function(1), string_agg(a::character, ',') FROM t1;
|
||||
SELECT const_function(1), count(b) FROM t1;
|
||||
|
|
|
@ -203,6 +203,7 @@ $$ LANGUAGE plpgsql;
|
|||
-- select res into var from fn();
|
||||
-- }
|
||||
--
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION func_calls_forcepush_func_infrom()
|
||||
RETURNS NUMERIC AS $$
|
||||
DECLARE incremented_val NUMERIC;
|
||||
|
@ -213,6 +214,7 @@ BEGIN
|
|||
RETURN incremented_val;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
|
||||
SELECT func_calls_forcepush_func_infrom();
|
||||
|
||||
|
@ -227,6 +229,7 @@ COMMIT;
|
|||
-- select fn() into var;
|
||||
-- }
|
||||
--
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION func_calls_forcepush_func_intarget()
|
||||
RETURNS NUMERIC AS $$
|
||||
DECLARE incremented_val NUMERIC;
|
||||
|
@ -237,6 +240,7 @@ BEGIN
|
|||
RETURN incremented_val;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
|
||||
SELECT func_calls_forcepush_func_intarget();
|
||||
|
||||
|
@ -336,6 +340,7 @@ BEGIN
|
|||
INSERT INTO emp VALUES (empname, 33);
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION outer_emp()
|
||||
RETURNS void
|
||||
AS $$
|
||||
|
@ -344,6 +349,7 @@ BEGIN
|
|||
PERFORM inner_emp('hello');
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
|
||||
SELECT create_distributed_function('inner_emp(text)','empname', force_delegation := true);
|
||||
SELECT outer_emp();
|
||||
|
@ -631,6 +637,7 @@ $$ LANGUAGE plpgsql;
|
|||
SELECT create_distributed_function('test_prepare(int,int)','x',force_delegation :=true, colocate_with := 'table_test_prepare');
|
||||
|
||||
DROP FUNCTION outer_test_prepare(int, int);
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION outer_test_prepare(x int, y int)
|
||||
RETURNS void
|
||||
AS $$
|
||||
|
@ -641,6 +648,7 @@ BEGIN
|
|||
PERFORM 1, 1 + a FROM test_prepare(x + 1, y + 1) a;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
|
||||
-- First 5 get delegated and succeeds
|
||||
BEGIN;
|
||||
|
|
|
@ -124,6 +124,7 @@ SET client_min_messages TO ERROR;
|
|||
-- function joins in CTE results can create lateral joins that are not supported
|
||||
-- we execute the query within a function to consolidate the error messages
|
||||
-- between different executors
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE FUNCTION raise_failed_execution_func_join(query text) RETURNS void AS $$
|
||||
BEGIN
|
||||
EXECUTE query;
|
||||
|
@ -135,6 +136,7 @@ BEGIN
|
|||
END IF;
|
||||
END;
|
||||
$$LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
|
||||
SELECT raise_failed_execution_func_join($$
|
||||
WITH one_row AS (
|
||||
|
|
|
@ -610,10 +610,6 @@ DROP TABLE http_request;
|
|||
|
||||
-- first create helper function
|
||||
CREATE OR REPLACE FUNCTION immutable_bleat(text) RETURNS int LANGUAGE plpgsql IMMUTABLE AS $$BEGIN RAISE NOTICE '%', $1;RETURN 1;END$$;
|
||||
\c - - - :worker_1_port
|
||||
CREATE OR REPLACE FUNCTION immutable_bleat(text) RETURNS int LANGUAGE plpgsql IMMUTABLE AS $$BEGIN RAISE NOTICE '%', $1;RETURN 1;END$$;
|
||||
\c - - - :worker_2_port
|
||||
CREATE OR REPLACE FUNCTION immutable_bleat(text) RETURNS int LANGUAGE plpgsql IMMUTABLE AS $$BEGIN RAISE NOTICE '%', $1;RETURN 1;END$$;
|
||||
\c - - - :master_port
|
||||
|
||||
-- test table
|
||||
|
|
|
@ -1278,17 +1278,8 @@ ORDER BY
|
|||
LIMIT 10;
|
||||
|
||||
-- this is one complex join query derived from a user's production query
|
||||
-- first declare the function on workers on master
|
||||
-- declare the function on workers and master
|
||||
-- With array_index:
|
||||
SELECT * FROM run_command_on_workers('CREATE OR REPLACE FUNCTION array_index(ANYARRAY, ANYELEMENT)
|
||||
RETURNS INT AS $$
|
||||
SELECT i
|
||||
FROM (SELECT generate_series(array_lower($1, 1), array_upper($1, 1))) g(i)
|
||||
WHERE $1 [i] = $2
|
||||
LIMIT 1;
|
||||
$$ LANGUAGE sql')
|
||||
ORDER BY 1,2;
|
||||
|
||||
CREATE OR REPLACE FUNCTION array_index(ANYARRAY, ANYELEMENT)
|
||||
RETURNS INT AS $$
|
||||
SELECT i
|
||||
|
@ -1431,8 +1422,6 @@ LIMIT 10;
|
|||
|
||||
|
||||
-- drop created functions
|
||||
SELECT * FROM run_command_on_workers('DROP FUNCTION array_index(ANYARRAY, ANYELEMENT)')
|
||||
ORDER BY 1,2;
|
||||
DROP FUNCTION array_index(ANYARRAY, ANYELEMENT);
|
||||
|
||||
-- a query with a constant subquery
|
||||
|
@ -1629,16 +1618,6 @@ CREATE FUNCTION test_join_function_2(integer, integer) RETURNS bool
|
|||
IMMUTABLE
|
||||
RETURNS NULL ON NULL INPUT;
|
||||
|
||||
SELECT run_command_on_workers($f$
|
||||
|
||||
CREATE FUNCTION test_join_function_2(integer, integer) RETURNS bool
|
||||
AS 'select $1 > $2;'
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE
|
||||
RETURNS NULL ON NULL INPUT;
|
||||
|
||||
$f$);
|
||||
|
||||
-- we don't support joins via functions
|
||||
SELECT user_id, array_length(events_table, 1)
|
||||
FROM (
|
||||
|
@ -1869,11 +1848,5 @@ LIMIT 1;
|
|||
|
||||
DROP FUNCTION test_join_function_2(integer, integer);
|
||||
|
||||
SELECT run_command_on_workers($f$
|
||||
|
||||
DROP FUNCTION test_join_function_2(integer, integer);
|
||||
|
||||
$f$);
|
||||
|
||||
SET citus.enable_router_execution TO TRUE;
|
||||
SET citus.subquery_pushdown to OFF;
|
||||
|
|
|
@ -25,6 +25,7 @@ SET citus.enable_repartition_joins TO ON;
|
|||
-- copied from multi_explain.sql and had to give
|
||||
-- a different name via postfix to prevent concurrent
|
||||
-- create/drop etc.
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
CREATE OR REPLACE FUNCTION explain_json_2(query text)
|
||||
RETURNS jsonb
|
||||
AS $BODY$
|
||||
|
@ -35,6 +36,7 @@ BEGIN
|
|||
RETURN result;
|
||||
END;
|
||||
$BODY$ LANGUAGE plpgsql;
|
||||
RESET citus.enable_metadata_sync;
|
||||
|
||||
|
||||
-- leaf queries contain colocated joins
|
||||
|
|
Loading…
Reference in New Issue