mirror of https://github.com/citusdata/citus.git
PG18 compatibility: misc output diffs (#8233)
6 minor changes to reduce some noise from the regression diffs. 1 - Add ORDER BY to fix subquery_in_where diff 2 - Disable buffers in explain analyze calls Leftover work from https://github.com/citusdata/citus/commit/f1f0b09f7 3 - Reduce verbosity to avoid diffs between PG versions Relevant PG commit: https://github.com/postgres/postgres/commit/0dca5d68d7 diff was: ``` CALL test_procedure_commit(2,5); ERROR: COMMIT is not allowed in an SQL function -CONTEXT: SQL function "test_procedure_commit" during startup +CONTEXT: SQL function "test_procedure_commit" statement 2 ``` 4 - Rename array_sort to array_sort_citus since PG18 added array_sort Relevant PG commit: https://github.com/postgres/postgres/commit/6c12ae09f5a Diff we were seeing in multi_array_agg, because the PG18 test was using PG18's array_sort function instead: ``` -- Check that we return NULL in case there are no input rows to array_agg() SELECT array_sort(array_agg(l_orderkey)) FROM lineitem WHERE l_orderkey < 0; array_sort ------------ - {} + (1 row) ``` 5 - Exclude not-null constraints from output to avoid diffs PG18 has added pg_constraint rows for not-null constraints Relevant PG commit https://github.com/postgres/postgres/commit/14e87ffa5c Remove them by condition contype <> 'n' 6 - Reduce verbosity to avoid md5 pwd deprecation warning in PG18 PG18 has deprecated MD5 passwords Relevant PG commit: https://github.com/postgres/postgres/commit/db6a4a985 Fixes #8154 Fixes #8157release-test
parent
77d5807fd6
commit
d9652bf5f9
|
|
@ -338,7 +338,9 @@ SELECT workers.result AS worker_password, pg_authid.rolpassword AS coord_passwor
|
|||
|
|
||||
(2 rows)
|
||||
|
||||
SET client_min_messages TO ERROR;
|
||||
ALTER ROLE new_role PASSWORD 'new_password';
|
||||
RESET client_min_messages;
|
||||
SELECT workers.result AS worker_password, pg_authid.rolpassword AS coord_password, workers.result = pg_authid.rolpassword AS password_is_same FROM run_command_on_workers($$SELECT rolpassword FROM pg_authid WHERE rolname = 'new_role'$$) workers, pg_authid WHERE pg_authid.rolname = 'new_role';
|
||||
worker_password | coord_password | password_is_same
|
||||
---------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -379,6 +379,7 @@ ORDER BY indexname;
|
|||
|
||||
SELECT conname FROM pg_constraint
|
||||
WHERE conrelid = 'heap_\''tbl'::regclass
|
||||
AND contype <> 'n'
|
||||
ORDER BY conname;
|
||||
conname
|
||||
---------------------------------------------------------------------
|
||||
|
|
@ -416,6 +417,7 @@ ORDER BY indexname;
|
|||
|
||||
SELECT conname FROM pg_constraint
|
||||
WHERE conrelid = 'heap_\''tbl'::regclass
|
||||
AND contype <> 'n'
|
||||
ORDER BY conname;
|
||||
conname
|
||||
---------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ SELECT con.conname
|
|||
FROM pg_catalog.pg_constraint con
|
||||
INNER JOIN pg_catalog.pg_class rel ON rel.oid = con.conrelid
|
||||
INNER JOIN pg_catalog.pg_namespace nsp ON nsp.oid = connamespace
|
||||
WHERE rel.relname = 'products';
|
||||
WHERE rel.relname = 'products' AND con.contype <> 'n';
|
||||
conname
|
||||
---------------------------------------------------------------------
|
||||
products_pkey
|
||||
|
|
@ -27,7 +27,7 @@ SELECT con.conname
|
|||
FROM pg_catalog.pg_constraint con
|
||||
INNER JOIN pg_catalog.pg_class rel ON rel.oid = con.conrelid
|
||||
INNER JOIN pg_catalog.pg_namespace nsp ON nsp.oid = connamespace
|
||||
WHERE rel.relname = 'products_ref';
|
||||
WHERE rel.relname = 'products_ref' AND con.contype <> 'n';
|
||||
conname
|
||||
---------------------------------------------------------------------
|
||||
products_ref_pkey2
|
||||
|
|
@ -41,7 +41,7 @@ SELECT con.conname
|
|||
FROM pg_catalog.pg_constraint con
|
||||
INNER JOIN pg_catalog.pg_class rel ON rel.oid = con.conrelid
|
||||
INNER JOIN pg_catalog.pg_namespace nsp ON nsp.oid = connamespace
|
||||
WHERE rel.relname LIKE 'very%';
|
||||
WHERE rel.relname LIKE 'very%' AND con.contype <> 'n';
|
||||
conname
|
||||
---------------------------------------------------------------------
|
||||
verylonglonglonglonglonglonglonglonglonglonglonglonglonglo_pkey
|
||||
|
|
@ -55,7 +55,7 @@ SELECT con.conname
|
|||
FROM pg_catalog.pg_constraint con
|
||||
INNER JOIN pg_catalog.pg_class rel ON rel.oid = con.conrelid
|
||||
INNER JOIN pg_catalog.pg_namespace nsp ON nsp.oid = connamespace
|
||||
WHERE rel.relname = 'dist_partitioned_table';
|
||||
WHERE rel.relname = 'dist_partitioned_table' AND con.contype <> 'n';
|
||||
conname
|
||||
---------------------------------------------------------------------
|
||||
dist_partitioned_table_pkey
|
||||
|
|
@ -68,7 +68,7 @@ SELECT con.conname
|
|||
FROM pg_catalog.pg_constraint con
|
||||
INNER JOIN pg_catalog.pg_class rel ON rel.oid = con.conrelid
|
||||
INNER JOIN pg_catalog.pg_namespace nsp ON nsp.oid = connamespace
|
||||
WHERE rel.relname = 'citus_local_table';
|
||||
WHERE rel.relname = 'citus_local_table' AND con.contype <> 'n';
|
||||
conname
|
||||
---------------------------------------------------------------------
|
||||
citus_local_table_pkey
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
SET citus.next_shard_id TO 520000;
|
||||
SET citus.coordinator_aggregation_strategy TO 'disabled';
|
||||
SELECT run_command_on_master_and_workers($r$
|
||||
CREATE OR REPLACE FUNCTION array_sort (ANYARRAY)
|
||||
CREATE OR REPLACE FUNCTION array_sort_citus (ANYARRAY)
|
||||
RETURNS ANYARRAY LANGUAGE SQL
|
||||
AS $$
|
||||
SELECT ARRAY(SELECT unnest($1) ORDER BY 1)
|
||||
|
|
@ -30,9 +30,9 @@ ERROR: array_agg with order by is unsupported
|
|||
SELECT array_agg(distinct l_orderkey ORDER BY l_orderkey) FROM lineitem;
|
||||
ERROR: array_agg with order by is unsupported
|
||||
-- Check array_agg() for different data types and LIMIT clauses
|
||||
SELECT array_sort(array_agg(l_partkey)) FROM lineitem GROUP BY l_orderkey
|
||||
SELECT array_sort_citus(array_agg(l_partkey)) FROM lineitem GROUP BY l_orderkey
|
||||
ORDER BY l_orderkey LIMIT 10;
|
||||
array_sort
|
||||
array_sort_citus
|
||||
---------------------------------------------------------------------
|
||||
{2132,15635,24027,63700,67310,155190}
|
||||
{106170}
|
||||
|
|
@ -46,9 +46,9 @@ SELECT array_sort(array_agg(l_partkey)) FROM lineitem GROUP BY l_orderkey
|
|||
{88362,89414,169544}
|
||||
(10 rows)
|
||||
|
||||
SELECT array_sort(array_agg(l_extendedprice)) FROM lineitem GROUP BY l_orderkey
|
||||
SELECT array_sort_citus(array_agg(l_extendedprice)) FROM lineitem GROUP BY l_orderkey
|
||||
ORDER BY l_orderkey LIMIT 10;
|
||||
array_sort
|
||||
array_sort_citus
|
||||
---------------------------------------------------------------------
|
||||
{13309.60,21168.23,22824.48,28955.64,45983.16,49620.16}
|
||||
{44694.46}
|
||||
|
|
@ -62,9 +62,9 @@ SELECT array_sort(array_agg(l_extendedprice)) FROM lineitem GROUP BY l_orderkey
|
|||
{9681.24,17554.68,30875.02}
|
||||
(10 rows)
|
||||
|
||||
SELECT array_sort(array_agg(l_shipdate)) FROM lineitem GROUP BY l_orderkey
|
||||
SELECT array_sort_citus(array_agg(l_shipdate)) FROM lineitem GROUP BY l_orderkey
|
||||
ORDER BY l_orderkey LIMIT 10;
|
||||
array_sort
|
||||
array_sort_citus
|
||||
---------------------------------------------------------------------
|
||||
{01-29-1996,01-30-1996,03-13-1996,03-30-1996,04-12-1996,04-21-1996}
|
||||
{01-28-1997}
|
||||
|
|
@ -78,9 +78,9 @@ SELECT array_sort(array_agg(l_shipdate)) FROM lineitem GROUP BY l_orderkey
|
|||
{10-09-1998,10-23-1998,10-30-1998}
|
||||
(10 rows)
|
||||
|
||||
SELECT array_sort(array_agg(l_shipmode)) FROM lineitem GROUP BY l_orderkey
|
||||
SELECT array_sort_citus(array_agg(l_shipmode)) FROM lineitem GROUP BY l_orderkey
|
||||
ORDER BY l_orderkey LIMIT 10;
|
||||
array_sort
|
||||
array_sort_citus
|
||||
---------------------------------------------------------------------
|
||||
{"AIR ","FOB ","MAIL ","MAIL ","REG AIR ","TRUCK "}
|
||||
{"RAIL "}
|
||||
|
|
@ -105,10 +105,10 @@ SELECT array_length(array_agg(l_orderkey), 1) FROM lineitem;
|
|||
-- shards and contain different aggregates, filter clauses and other complex
|
||||
-- expressions. Note that the l_orderkey ranges are such that the matching rows
|
||||
-- lie in different shards.
|
||||
SELECT l_quantity, count(*), avg(l_extendedprice), array_sort(array_agg(l_orderkey)) FROM lineitem
|
||||
SELECT l_quantity, count(*), avg(l_extendedprice), array_sort_citus(array_agg(l_orderkey)) FROM lineitem
|
||||
WHERE l_quantity < 5 AND l_orderkey > 5500 AND l_orderkey < 9500
|
||||
GROUP BY l_quantity ORDER BY l_quantity;
|
||||
l_quantity | count | avg | array_sort
|
||||
l_quantity | count | avg | array_sort_citus
|
||||
---------------------------------------------------------------------
|
||||
1.00 | 17 | 1477.1258823529411765 | {5543,5633,5634,5698,5766,5856,5857,5986,8997,9026,9158,9184,9220,9222,9348,9383,9476}
|
||||
2.00 | 19 | 3078.4242105263157895 | {5506,5540,5573,5669,5703,5730,5798,5831,5893,5920,5923,9030,9058,9123,9124,9188,9344,9441,9476}
|
||||
|
|
@ -116,7 +116,7 @@ SELECT l_quantity, count(*), avg(l_extendedprice), array_sort(array_agg(l_orderk
|
|||
4.00 | 19 | 5929.7136842105263158 | {5504,5507,5508,5511,5538,5764,5766,5826,5829,5862,5959,5985,9091,9120,9281,9347,9382,9440,9473}
|
||||
(4 rows)
|
||||
|
||||
SELECT l_quantity, array_sort(array_agg(extract (month FROM o_orderdate))) AS my_month
|
||||
SELECT l_quantity, array_sort_citus(array_agg(extract (month FROM o_orderdate))) AS my_month
|
||||
FROM lineitem, orders WHERE l_orderkey = o_orderkey AND l_quantity < 5
|
||||
AND l_orderkey > 5500 AND l_orderkey < 9500 GROUP BY l_quantity ORDER BY l_quantity;
|
||||
l_quantity | my_month
|
||||
|
|
@ -127,10 +127,10 @@ SELECT l_quantity, array_sort(array_agg(extract (month FROM o_orderdate))) AS my
|
|||
4.00 | {1,1,1,2,2,2,5,5,6,6,6,6,8,9,10,10,11,11,12}
|
||||
(4 rows)
|
||||
|
||||
SELECT l_quantity, array_sort(array_agg(l_orderkey * 2 + 1)) FROM lineitem WHERE l_quantity < 5
|
||||
SELECT l_quantity, array_sort_citus(array_agg(l_orderkey * 2 + 1)) FROM lineitem WHERE l_quantity < 5
|
||||
AND octet_length(l_comment) + octet_length('randomtext'::text) > 40
|
||||
AND l_orderkey > 5500 AND l_orderkey < 9500 GROUP BY l_quantity ORDER BY l_quantity;
|
||||
l_quantity | array_sort
|
||||
l_quantity | array_sort_citus
|
||||
---------------------------------------------------------------------
|
||||
1.00 | {11269,11397,11713,11715,11973,18317,18445}
|
||||
2.00 | {11847,18061,18247,18953}
|
||||
|
|
@ -139,17 +139,17 @@ SELECT l_quantity, array_sort(array_agg(l_orderkey * 2 + 1)) FROM lineitem WHERE
|
|||
(4 rows)
|
||||
|
||||
-- Check that we can execute array_agg() with an expression containing NULL values
|
||||
SELECT array_sort(array_agg(case when l_quantity > 20 then l_quantity else NULL end))
|
||||
SELECT array_sort_citus(array_agg(case when l_quantity > 20 then l_quantity else NULL end))
|
||||
FROM lineitem WHERE l_orderkey < 10;
|
||||
array_sort
|
||||
array_sort_citus
|
||||
---------------------------------------------------------------------
|
||||
{24.00,26.00,26.00,27.00,28.00,28.00,28.00,30.00,32.00,35.00,36.00,37.00,38.00,38.00,45.00,46.00,49.00,50.00,NULL,NULL,NULL,NULL,NULL,NULL,NULL}
|
||||
(1 row)
|
||||
|
||||
-- Check that we return NULL in case there are no input rows to array_agg()
|
||||
SELECT array_sort(array_agg(l_orderkey))
|
||||
SELECT array_sort_citus(array_agg(l_orderkey))
|
||||
FROM lineitem WHERE l_orderkey < 0;
|
||||
array_sort
|
||||
array_sort_citus
|
||||
---------------------------------------------------------------------
|
||||
{}
|
||||
(1 row)
|
||||
|
|
|
|||
|
|
@ -55,7 +55,9 @@ SELECT pg_sleep(0.1);
|
|||
|
||||
(1 row)
|
||||
|
||||
SET client_min_messages TO ERROR;
|
||||
ALTER ROLE CURRENT_USER WITH PASSWORD 'dummypassword';
|
||||
RESET client_min_messages;
|
||||
-- Show that, with no MX tables, activate node snapshot contains only the delete commands,
|
||||
-- pg_dist_node entries, pg_dist_object entries and roles.
|
||||
SELECT unnest(activate_node_snapshot()) order by 1;
|
||||
|
|
|
|||
|
|
@ -65,7 +65,9 @@ SELECT pg_sleep(0.1);
|
|||
|
||||
(1 row)
|
||||
|
||||
SET client_min_messages TO ERROR;
|
||||
ALTER ROLE CURRENT_USER WITH PASSWORD 'dummypassword';
|
||||
RESET client_min_messages;
|
||||
-- Show that, with no MX tables, activate node snapshot contains only the delete commands,
|
||||
-- pg_dist_node entries, pg_dist_object entries and roles.
|
||||
SELECT unnest(activate_node_snapshot()) order by 1;
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ CREATE TABLE part_table_p202009 PARTITION OF part_table FOR VALUES FROM ('2020-0
|
|||
SELECT relname, conname, pg_catalog.pg_get_constraintdef(con.oid, true)
|
||||
FROM pg_constraint con JOIN pg_class rel ON (rel.oid=con.conrelid)
|
||||
WHERE relname LIKE 'part_table%'
|
||||
AND contype <> 'n'
|
||||
ORDER BY 1,2,3;
|
||||
relname | conname | pg_get_constraintdef
|
||||
---------------------------------------------------------------------
|
||||
|
|
@ -70,6 +71,7 @@ ORDER BY 1,2,3;
|
|||
SELECT relname, conname, pg_catalog.pg_get_constraintdef(con.oid, true)
|
||||
FROM pg_constraint con JOIN pg_class rel ON (rel.oid=con.conrelid)
|
||||
WHERE relname SIMILAR TO 'part_table%\_\d%'
|
||||
AND contype <> 'n'
|
||||
ORDER BY 1,2,3;
|
||||
relname | conname | pg_get_constraintdef
|
||||
---------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -2083,7 +2083,7 @@ CONTEXT: PL/pgSQL function public.explain_filter(text) line XX at FOR over EXEC
|
|||
Memory: used=NkB allocated=NkB
|
||||
(9 rows)
|
||||
|
||||
select public.explain_filter('explain (memory, analyze) select * from int8_tbl i8');
|
||||
select public.explain_filter('explain (memory, analyze, buffers false) select * from int8_tbl i8');
|
||||
NOTICE: issuing SELECT * FROM worker_save_query_explain_analyze('SELECT q1, q2 FROM pg17.int8_tbl_12242024 i8 WHERE true', '{"verbose": false, "costs": true, "buffers": false, "wal": false, "memory": true, "serialize": "none", "timing": true, "summary": true, "format": "TEXT"}') AS (field_0 bigint, field_1 bigint)
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
CONTEXT: PL/pgSQL function public.explain_filter(text) line XX at FOR over EXECUTE statement
|
||||
|
|
@ -2149,7 +2149,7 @@ CONTEXT: PL/pgSQL function public.explain_filter(text) line XX at FOR over EXEC
|
|||
Planning Time: N.N
|
||||
(1 row)
|
||||
|
||||
select public.explain_filter('explain (memory, analyze, format json) select * from int8_tbl i8');
|
||||
select public.explain_filter('explain (memory, analyze, buffers false, format json) select * from int8_tbl i8');
|
||||
NOTICE: issuing SELECT * FROM worker_save_query_explain_analyze('SELECT q1, q2 FROM pg17.int8_tbl_12242024 i8 WHERE true', '{"verbose": false, "costs": true, "buffers": false, "wal": false, "memory": true, "serialize": "none", "timing": true, "summary": true, "format": "JSON"}') AS (field_0 bigint, field_1 bigint)
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
CONTEXT: PL/pgSQL function public.explain_filter(text) line XX at FOR over EXECUTE statement
|
||||
|
|
@ -2366,7 +2366,7 @@ CONTEXT: PL/pgSQL function public.explain_filter(text) line XX at FOR over EXEC
|
|||
Execution Time: N.N
|
||||
(1 row)
|
||||
|
||||
select public.explain_filter('explain (analyze,serialize) select * from int8_tbl i8');
|
||||
select public.explain_filter('explain (analyze, buffers false, serialize) select * from int8_tbl i8');
|
||||
NOTICE: issuing SELECT * FROM worker_save_query_explain_analyze('SELECT q1, q2 FROM pg17.int8_tbl_12242024 i8 WHERE true', '{"verbose": false, "costs": true, "buffers": false, "wal": false, "memory": false, "serialize": "text", "timing": true, "summary": true, "format": "TEXT"}') AS (field_0 bigint, field_1 bigint)
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
CONTEXT: PL/pgSQL function public.explain_filter(text) line XX at FOR over EXECUTE statement
|
||||
|
|
@ -2433,7 +2433,7 @@ CONTEXT: PL/pgSQL function public.explain_filter(text) line XX at FOR over EXEC
|
|||
(14 rows)
|
||||
|
||||
-- this tests an edge case where we have no data to return
|
||||
select public.explain_filter('explain (analyze,serialize) create temp table explain_temp as select * from int8_tbl i8');
|
||||
select public.explain_filter('explain (analyze, buffers false, serialize) create temp table explain_temp as select * from int8_tbl i8');
|
||||
NOTICE: issuing SELECT * FROM worker_save_query_explain_analyze('SELECT q1, q2 FROM pg17.int8_tbl_12242024 i8 WHERE true', '{"verbose": false, "costs": true, "buffers": false, "wal": false, "memory": false, "serialize": "text", "timing": true, "summary": true, "format": "TEXT"}') AS (field_0 bigint, field_1 bigint)
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
CONTEXT: PL/pgSQL function public.explain_filter(text) line XX at FOR over EXECUTE statement
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ SELECT * FROM test_table ORDER BY 1, 2;
|
|||
|
||||
-- commit/rollback is not allowed in procedures in SQL
|
||||
-- following calls should fail
|
||||
\set VERBOSITY terse
|
||||
CREATE PROCEDURE test_procedure_commit(tt_id int, tt_org_id int) LANGUAGE SQL AS $$
|
||||
DELETE FROM test_table;
|
||||
COMMIT;
|
||||
|
|
@ -38,7 +39,6 @@ CREATE PROCEDURE test_procedure_commit(tt_id int, tt_org_id int) LANGUAGE SQL AS
|
|||
$$;
|
||||
CALL test_procedure_commit(2,5);
|
||||
ERROR: COMMIT is not allowed in an SQL function
|
||||
CONTEXT: SQL function "test_procedure_commit" during startup
|
||||
SELECT * FROM test_table ORDER BY 1, 2;
|
||||
id | org_id
|
||||
---------------------------------------------------------------------
|
||||
|
|
@ -53,7 +53,6 @@ CREATE PROCEDURE test_procedure_rollback(tt_id int, tt_org_id int) LANGUAGE SQL
|
|||
$$;
|
||||
CALL test_procedure_rollback(2,15);
|
||||
ERROR: ROLLBACK is not allowed in an SQL function
|
||||
CONTEXT: SQL function "test_procedure_rollback" during startup
|
||||
SELECT * FROM test_table ORDER BY 1, 2;
|
||||
id | org_id
|
||||
---------------------------------------------------------------------
|
||||
|
|
@ -63,6 +62,7 @@ SELECT * FROM test_table ORDER BY 1, 2;
|
|||
DROP PROCEDURE test_procedure_delete_insert(int, int);
|
||||
DROP PROCEDURE test_procedure_commit(int, int);
|
||||
DROP PROCEDURE test_procedure_rollback(int, int);
|
||||
\set VERBOSITY default
|
||||
-- same tests with plpgsql
|
||||
-- test CREATE PROCEDURE
|
||||
CREATE PROCEDURE test_procedure_delete_insert(id int, org_id int) LANGUAGE PLPGSQL AS $$
|
||||
|
|
|
|||
|
|
@ -42,10 +42,11 @@ SELECT *
|
|||
FROM (SELECT 1 AS id, 2 AS value_1, 3 AS value_3
|
||||
UNION ALL SELECT 2 as id, 3 as value_1, 4 as value_3) AS tt1
|
||||
WHERE id IN (SELECT user_id
|
||||
FROM events_table);
|
||||
FROM events_table)
|
||||
ORDER BY 1;
|
||||
DEBUG: generating subplan XXX_1 for subquery SELECT 1 AS id, 2 AS value_1, 3 AS value_3 UNION ALL SELECT 2 AS id, 3 AS value_1, 4 AS value_3
|
||||
DEBUG: generating subplan XXX_2 for subquery SELECT user_id FROM public.events_table
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT id, value_1, value_3 FROM (SELECT intermediate_result.id, intermediate_result.value_1, intermediate_result.value_3 FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(id integer, value_1 integer, value_3 integer)) tt1 WHERE (id OPERATOR(pg_catalog.=) ANY (SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_2'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer)))
|
||||
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT id, value_1, value_3 FROM (SELECT intermediate_result.id, intermediate_result.value_1, intermediate_result.value_3 FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(id integer, value_1 integer, value_3 integer)) tt1 WHERE (id OPERATOR(pg_catalog.=) ANY (SELECT intermediate_result.user_id FROM read_intermediate_result('XXX_2'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer))) ORDER BY id
|
||||
id | value_1 | value_3
|
||||
---------------------------------------------------------------------
|
||||
1 | 2 | 3
|
||||
|
|
|
|||
|
|
@ -112,7 +112,9 @@ SELECT workers.result AS worker_password, pg_authid.rolpassword AS coord_passwor
|
|||
ALTER ROLE new_role PASSWORD '';
|
||||
SELECT workers.result AS worker_password, pg_authid.rolpassword AS coord_password FROM run_command_on_workers($$SELECT rolpassword FROM pg_authid WHERE rolname = 'new_role'$$) workers, pg_authid WHERE pg_authid.rolname = 'new_role';
|
||||
|
||||
SET client_min_messages TO ERROR;
|
||||
ALTER ROLE new_role PASSWORD 'new_password';
|
||||
RESET client_min_messages;
|
||||
SELECT workers.result AS worker_password, pg_authid.rolpassword AS coord_password, workers.result = pg_authid.rolpassword AS password_is_same FROM run_command_on_workers($$SELECT rolpassword FROM pg_authid WHERE rolname = 'new_role'$$) workers, pg_authid WHERE pg_authid.rolname = 'new_role';
|
||||
|
||||
ALTER ROLE new_role PASSWORD NULL;
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@ ORDER BY indexname;
|
|||
|
||||
SELECT conname FROM pg_constraint
|
||||
WHERE conrelid = 'heap_\''tbl'::regclass
|
||||
AND contype <> 'n'
|
||||
ORDER BY conname;
|
||||
|
||||
SELECT alter_table_set_access_method('heap_\''tbl', 'columnar');
|
||||
|
|
@ -154,6 +155,7 @@ ORDER BY indexname;
|
|||
|
||||
SELECT conname FROM pg_constraint
|
||||
WHERE conrelid = 'heap_\''tbl'::regclass
|
||||
AND contype <> 'n'
|
||||
ORDER BY conname;
|
||||
|
||||
-- test different table types
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ SELECT con.conname
|
|||
FROM pg_catalog.pg_constraint con
|
||||
INNER JOIN pg_catalog.pg_class rel ON rel.oid = con.conrelid
|
||||
INNER JOIN pg_catalog.pg_namespace nsp ON nsp.oid = connamespace
|
||||
WHERE rel.relname = 'products';
|
||||
WHERE rel.relname = 'products' AND con.contype <> 'n';
|
||||
|
||||
ALTER TABLE products DROP CONSTRAINT products_pkey;
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ SELECT con.conname
|
|||
FROM pg_catalog.pg_constraint con
|
||||
INNER JOIN pg_catalog.pg_class rel ON rel.oid = con.conrelid
|
||||
INNER JOIN pg_catalog.pg_namespace nsp ON nsp.oid = connamespace
|
||||
WHERE rel.relname = 'products_ref';
|
||||
WHERE rel.relname = 'products_ref' AND con.contype <> 'n';
|
||||
|
||||
ALTER TABLE products_ref DROP CONSTRAINT products_ref_pkey2;
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ SELECT con.conname
|
|||
FROM pg_catalog.pg_constraint con
|
||||
INNER JOIN pg_catalog.pg_class rel ON rel.oid = con.conrelid
|
||||
INNER JOIN pg_catalog.pg_namespace nsp ON nsp.oid = connamespace
|
||||
WHERE rel.relname LIKE 'very%';
|
||||
WHERE rel.relname LIKE 'very%' AND con.contype <> 'n';
|
||||
|
||||
ALTER TABLE verylonglonglonglonglonglonglonglonglonglonglonglonglonglonglon DROP CONSTRAINT verylonglonglonglonglonglonglonglonglonglonglonglonglonglo_pkey;
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ SELECT con.conname
|
|||
FROM pg_catalog.pg_constraint con
|
||||
INNER JOIN pg_catalog.pg_class rel ON rel.oid = con.conrelid
|
||||
INNER JOIN pg_catalog.pg_namespace nsp ON nsp.oid = connamespace
|
||||
WHERE rel.relname = 'dist_partitioned_table';
|
||||
WHERE rel.relname = 'dist_partitioned_table' AND con.contype <> 'n';
|
||||
|
||||
ALTER TABLE dist_partitioned_table DROP CONSTRAINT dist_partitioned_table_pkey;
|
||||
|
||||
|
|
@ -63,4 +63,4 @@ SELECT con.conname
|
|||
FROM pg_catalog.pg_constraint con
|
||||
INNER JOIN pg_catalog.pg_class rel ON rel.oid = con.conrelid
|
||||
INNER JOIN pg_catalog.pg_namespace nsp ON nsp.oid = connamespace
|
||||
WHERE rel.relname = 'citus_local_table';
|
||||
WHERE rel.relname = 'citus_local_table' AND con.contype <> 'n';
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ SET citus.next_shard_id TO 520000;
|
|||
SET citus.coordinator_aggregation_strategy TO 'disabled';
|
||||
|
||||
SELECT run_command_on_master_and_workers($r$
|
||||
CREATE OR REPLACE FUNCTION array_sort (ANYARRAY)
|
||||
CREATE OR REPLACE FUNCTION array_sort_citus (ANYARRAY)
|
||||
RETURNS ANYARRAY LANGUAGE SQL
|
||||
AS $$
|
||||
SELECT ARRAY(SELECT unnest($1) ORDER BY 1)
|
||||
|
|
@ -28,16 +28,16 @@ SELECT array_agg(distinct l_orderkey ORDER BY l_orderkey) FROM lineitem;
|
|||
|
||||
-- Check array_agg() for different data types and LIMIT clauses
|
||||
|
||||
SELECT array_sort(array_agg(l_partkey)) FROM lineitem GROUP BY l_orderkey
|
||||
SELECT array_sort_citus(array_agg(l_partkey)) FROM lineitem GROUP BY l_orderkey
|
||||
ORDER BY l_orderkey LIMIT 10;
|
||||
|
||||
SELECT array_sort(array_agg(l_extendedprice)) FROM lineitem GROUP BY l_orderkey
|
||||
SELECT array_sort_citus(array_agg(l_extendedprice)) FROM lineitem GROUP BY l_orderkey
|
||||
ORDER BY l_orderkey LIMIT 10;
|
||||
|
||||
SELECT array_sort(array_agg(l_shipdate)) FROM lineitem GROUP BY l_orderkey
|
||||
SELECT array_sort_citus(array_agg(l_shipdate)) FROM lineitem GROUP BY l_orderkey
|
||||
ORDER BY l_orderkey LIMIT 10;
|
||||
|
||||
SELECT array_sort(array_agg(l_shipmode)) FROM lineitem GROUP BY l_orderkey
|
||||
SELECT array_sort_citus(array_agg(l_shipmode)) FROM lineitem GROUP BY l_orderkey
|
||||
ORDER BY l_orderkey LIMIT 10;
|
||||
|
||||
-- Check that we can execute array_agg() within other functions
|
||||
|
|
@ -49,24 +49,24 @@ SELECT array_length(array_agg(l_orderkey), 1) FROM lineitem;
|
|||
-- expressions. Note that the l_orderkey ranges are such that the matching rows
|
||||
-- lie in different shards.
|
||||
|
||||
SELECT l_quantity, count(*), avg(l_extendedprice), array_sort(array_agg(l_orderkey)) FROM lineitem
|
||||
SELECT l_quantity, count(*), avg(l_extendedprice), array_sort_citus(array_agg(l_orderkey)) FROM lineitem
|
||||
WHERE l_quantity < 5 AND l_orderkey > 5500 AND l_orderkey < 9500
|
||||
GROUP BY l_quantity ORDER BY l_quantity;
|
||||
|
||||
SELECT l_quantity, array_sort(array_agg(extract (month FROM o_orderdate))) AS my_month
|
||||
SELECT l_quantity, array_sort_citus(array_agg(extract (month FROM o_orderdate))) AS my_month
|
||||
FROM lineitem, orders WHERE l_orderkey = o_orderkey AND l_quantity < 5
|
||||
AND l_orderkey > 5500 AND l_orderkey < 9500 GROUP BY l_quantity ORDER BY l_quantity;
|
||||
|
||||
SELECT l_quantity, array_sort(array_agg(l_orderkey * 2 + 1)) FROM lineitem WHERE l_quantity < 5
|
||||
SELECT l_quantity, array_sort_citus(array_agg(l_orderkey * 2 + 1)) FROM lineitem WHERE l_quantity < 5
|
||||
AND octet_length(l_comment) + octet_length('randomtext'::text) > 40
|
||||
AND l_orderkey > 5500 AND l_orderkey < 9500 GROUP BY l_quantity ORDER BY l_quantity;
|
||||
|
||||
-- Check that we can execute array_agg() with an expression containing NULL values
|
||||
|
||||
SELECT array_sort(array_agg(case when l_quantity > 20 then l_quantity else NULL end))
|
||||
SELECT array_sort_citus(array_agg(case when l_quantity > 20 then l_quantity else NULL end))
|
||||
FROM lineitem WHERE l_orderkey < 10;
|
||||
|
||||
-- Check that we return NULL in case there are no input rows to array_agg()
|
||||
|
||||
SELECT array_sort(array_agg(l_orderkey))
|
||||
SELECT array_sort_citus(array_agg(l_orderkey))
|
||||
FROM lineitem WHERE l_orderkey < 0;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,9 @@ SELECT * FROM pg_dist_partition WHERE partmethod='h' AND repmodel='s';
|
|||
ALTER SYSTEM SET password_encryption TO md5;
|
||||
SELECT pg_reload_conf();
|
||||
SELECT pg_sleep(0.1);
|
||||
SET client_min_messages TO ERROR;
|
||||
ALTER ROLE CURRENT_USER WITH PASSWORD 'dummypassword';
|
||||
RESET client_min_messages;
|
||||
|
||||
-- Show that, with no MX tables, activate node snapshot contains only the delete commands,
|
||||
-- pg_dist_node entries, pg_dist_object entries and roles.
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ CREATE TABLE part_table_p202009 PARTITION OF part_table FOR VALUES FROM ('2020-0
|
|||
SELECT relname, conname, pg_catalog.pg_get_constraintdef(con.oid, true)
|
||||
FROM pg_constraint con JOIN pg_class rel ON (rel.oid=con.conrelid)
|
||||
WHERE relname LIKE 'part_table%'
|
||||
AND contype <> 'n'
|
||||
ORDER BY 1,2,3;
|
||||
|
||||
-- check the constraint names on the worker node
|
||||
|
|
@ -47,6 +48,7 @@ ORDER BY 1,2,3;
|
|||
SELECT relname, conname, pg_catalog.pg_get_constraintdef(con.oid, true)
|
||||
FROM pg_constraint con JOIN pg_class rel ON (rel.oid=con.conrelid)
|
||||
WHERE relname SIMILAR TO 'part_table%\_\d%'
|
||||
AND contype <> 'n'
|
||||
ORDER BY 1,2,3;
|
||||
|
||||
\c - - - :master_port
|
||||
|
|
|
|||
|
|
@ -1290,19 +1290,19 @@ SET citus.log_remote_commands TO true;
|
|||
SET citus.grep_remote_commands TO '%12242024%';
|
||||
|
||||
select public.explain_filter('explain (memory) select * from int8_tbl i8');
|
||||
select public.explain_filter('explain (memory, analyze) select * from int8_tbl i8');
|
||||
select public.explain_filter('explain (memory, analyze, buffers false) select * from int8_tbl i8');
|
||||
select public.explain_filter('explain (memory, summary, format yaml) select * from int8_tbl i8');
|
||||
select public.explain_filter('explain (memory, analyze, format json) select * from int8_tbl i8');
|
||||
select public.explain_filter('explain (memory, analyze, buffers false, format json) select * from int8_tbl i8');
|
||||
prepare int8_query as select * from int8_tbl i8;
|
||||
select public.explain_filter('explain (memory) execute int8_query');
|
||||
|
||||
-- serialize tests, same as postgres tests, we just distributed the table
|
||||
select public.explain_filter('explain (analyze, serialize, buffers, format yaml) select * from int8_tbl i8');
|
||||
select public.explain_filter('explain (analyze,serialize) select * from int8_tbl i8');
|
||||
select public.explain_filter('explain (analyze, buffers false, serialize) select * from int8_tbl i8');
|
||||
select public.explain_filter('explain (analyze,serialize text,buffers,timing off) select * from int8_tbl i8');
|
||||
select public.explain_filter('explain (analyze,serialize binary,buffers,timing) select * from int8_tbl i8');
|
||||
-- this tests an edge case where we have no data to return
|
||||
select public.explain_filter('explain (analyze,serialize) create temp table explain_temp as select * from int8_tbl i8');
|
||||
select public.explain_filter('explain (analyze, buffers false, serialize) create temp table explain_temp as select * from int8_tbl i8');
|
||||
|
||||
RESET citus.log_remote_commands;
|
||||
-- End of EXPLAIN MEMORY SERIALIZE tests
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@ SELECT * FROM test_table ORDER BY 1, 2;
|
|||
|
||||
-- commit/rollback is not allowed in procedures in SQL
|
||||
-- following calls should fail
|
||||
|
||||
\set VERBOSITY terse
|
||||
|
||||
CREATE PROCEDURE test_procedure_commit(tt_id int, tt_org_id int) LANGUAGE SQL AS $$
|
||||
DELETE FROM test_table;
|
||||
COMMIT;
|
||||
|
|
@ -52,6 +55,8 @@ DROP PROCEDURE test_procedure_delete_insert(int, int);
|
|||
DROP PROCEDURE test_procedure_commit(int, int);
|
||||
DROP PROCEDURE test_procedure_rollback(int, int);
|
||||
|
||||
\set VERBOSITY default
|
||||
|
||||
-- same tests with plpgsql
|
||||
|
||||
-- test CREATE PROCEDURE
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@ SELECT *
|
|||
FROM (SELECT 1 AS id, 2 AS value_1, 3 AS value_3
|
||||
UNION ALL SELECT 2 as id, 3 as value_1, 4 as value_3) AS tt1
|
||||
WHERE id IN (SELECT user_id
|
||||
FROM events_table);
|
||||
FROM events_table)
|
||||
ORDER BY 1;
|
||||
|
||||
-- Recurring tuples in from clause as CTE and SET operation in WHERE clause
|
||||
SELECT Count(*)
|
||||
|
|
|
|||
Loading…
Reference in New Issue