From 3bcb2cf2153a7a0acc9bbf66330977d53a9aa49a Mon Sep 17 00:00:00 2001 From: Mehmet Yilmaz Date: Tue, 5 Aug 2025 07:17:57 +0000 Subject: [PATCH] Enable BUFFERS with EXPLAIN ANALYZE by default c2a4078ebad71999dd451ae7d4358be3c9290b07 --- src/test/regress/bin/normalize.sed | 7 ++ src/test/regress/expected/check_mx.out | 2 +- .../expected/citus_local_tables_ent.out | 2 +- .../expected/logical_rep_consistency.out | 4 +- .../regress/expected/logical_replication.out | 18 ++--- .../multi_alter_table_row_level_security.out | 54 ++++++------- .../expected/multi_cluster_management.out | 76 +++++++++---------- .../expected/multi_create_role_dependency.out | 4 +- .../regress/expected/multi_create_table.out | 8 +- .../expected/multi_create_table_superuser.out | 28 +++---- .../regress/expected/multi_data_types.out | 8 +- .../regress/expected/multi_multiuser_auth.out | 6 +- .../multi_multiuser_basic_queries.out | 4 +- .../expected/multi_multiuser_grant.out | 4 +- .../multi_multiuser_master_protocol.out | 50 ++++++------ .../expected/multi_tenant_isolation.out | 30 ++++---- .../multi_tenant_isolation_nonblocking.out | 30 ++++---- src/test/regress/expected/publication.out | 2 +- src/test/regress/expected/publication_0.out | 2 +- .../expected/shard_move_constraints.out | 20 ++--- .../shard_move_constraints_blocking.out | 20 ++--- src/test/regress/expected/stat_statements.out | 52 ++++++------- 22 files changed, 219 insertions(+), 212 deletions(-) diff --git a/src/test/regress/bin/normalize.sed b/src/test/regress/bin/normalize.sed index 48396fcfd..33f42096d 100644 --- a/src/test/regress/bin/normalize.sed +++ b/src/test/regress/bin/normalize.sed @@ -328,3 +328,10 @@ s/\| CHECK ([a-zA-Z])(.*)/| CHECK \(\1\2\)/g # pg18 change: strip trailing “.00” (or “.0…”) from actual rows counts s/(actual rows=[0-9]+)\.[0-9]+/\1/g + +# ignore only the PG18 “shared hit” buffer summary line +/^\s*Buffers: shared hit=.*$/d + +# normalize varying row‐count summaries +# turn any “(7 rows)”, “(8 rows)”, etc. into “(N rows)” +s/^\([0-9]+ rows\)$/(N rows)/g diff --git a/src/test/regress/expected/check_mx.out b/src/test/regress/expected/check_mx.out index b19445229..c38948bfe 100644 --- a/src/test/regress/expected/check_mx.out +++ b/src/test/regress/expected/check_mx.out @@ -18,5 +18,5 @@ SELECT unnest(result::text[]) AS unnested_result FROM run_command_on_workers($$SELECT array_agg(pg_identify_object_as_address(classid, objid, objsubid)) from pg_catalog.pg_dist_object$$); pg_identify_object_as_address --------------------------------------------------------------------- -(0 rows) +(N rows) diff --git a/src/test/regress/expected/citus_local_tables_ent.out b/src/test/regress/expected/citus_local_tables_ent.out index 99e18109f..371d9c598 100644 --- a/src/test/regress/expected/citus_local_tables_ent.out +++ b/src/test/regress/expected/citus_local_tables_ent.out @@ -63,7 +63,7 @@ SELECT * FROM citus_local_table ORDER BY 1, 2; NOTICE: executing the command locally: SELECT a, b FROM citus_local_tables_ent.citus_local_table_1511000 citus_local_table ORDER BY a, b a | b --------------------------------------------------------------------- -(0 rows) +(N rows) RESET ROLE; -- create policy for user to read access for rows with a=1 diff --git a/src/test/regress/expected/logical_rep_consistency.out b/src/test/regress/expected/logical_rep_consistency.out index d532bda26..a145a2c16 100644 --- a/src/test/regress/expected/logical_rep_consistency.out +++ b/src/test/regress/expected/logical_rep_consistency.out @@ -9,14 +9,14 @@ SELECT run_command_on_workers($$alter system SET citus.show_shards_for_app_name_ --------------------------------------------------------------------- (localhost,57637,t,"ALTER SYSTEM") (localhost,57638,t,"ALTER SYSTEM") -(2 rows) +(N rows) SELECT run_command_on_workers($$SELECT pg_reload_conf();$$); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,t) (localhost,57638,t,t) -(2 rows) +(N rows) CREATE TABLE test(a int primary key); SELECT create_distributed_table('test', 'a', colocate_with:='none'); diff --git a/src/test/regress/expected/logical_replication.out b/src/test/regress/expected/logical_replication.out index b5a36125a..a103badfe 100644 --- a/src/test/regress/expected/logical_replication.out +++ b/src/test/regress/expected/logical_replication.out @@ -41,12 +41,12 @@ SELECT subname from pg_subscription; SELECT pubname from pg_publication; pubname --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT slot_name from pg_replication_slots; slot_name --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT count(*) FROM dist; count @@ -59,7 +59,7 @@ SET search_path TO logical_replication; SELECT subname from pg_subscription; subname --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT pubname from pg_publication; pubname @@ -104,12 +104,12 @@ SELECT subname from pg_subscription; SELECT pubname from pg_publication; pubname --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT slot_name from pg_replication_slots; slot_name --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT count(*) from dist; count @@ -124,7 +124,7 @@ SET search_path TO logical_replication; SELECT subname from pg_subscription; subname --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT pubname from pg_publication; pubname @@ -156,17 +156,17 @@ SET search_path TO logical_replication; SELECT subname from pg_subscription; subname --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT pubname from pg_publication; pubname --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT slot_name from pg_replication_slots; slot_name --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT count(*) from dist; count diff --git a/src/test/regress/expected/multi_alter_table_row_level_security.out b/src/test/regress/expected/multi_alter_table_row_level_security.out index d82f76a25..2262b2877 100644 --- a/src/test/regress/expected/multi_alter_table_row_level_security.out +++ b/src/test/regress/expected/multi_alter_table_row_level_security.out @@ -50,7 +50,7 @@ SELECT * FROM events ORDER BY 1; --------------------------------------------------------------------- 1 | 1 | push 2 | 2 | push -(2 rows) +(N rows) -- Switch user that has been granted rights and read table SET ROLE rls_tenant_1; @@ -59,7 +59,7 @@ SELECT * FROM events ORDER BY 1; --------------------------------------------------------------------- 1 | 1 | push 2 | 2 | push -(2 rows) +(N rows) RESET ROLE; -- Enable row level security @@ -71,7 +71,7 @@ SELECT * FROM events ORDER BY 1; --------------------------------------------------------------------- 1 | 1 | push 2 | 2 | push -(2 rows) +(N rows) RESET ROLE; -- Switch user that has been granted rights, should not be able to see any rows @@ -79,7 +79,7 @@ SET ROLE rls_tenant_1; SELECT * FROM events ORDER BY 1; tenant_id | id | type --------------------------------------------------------------------- -(0 rows) +(N rows) RESET ROLE; -- Create policy for tenants to read access their own rows @@ -112,7 +112,7 @@ SET ROLE rls_tenant_2; SELECT * FROM events ORDER BY 1; tenant_id | id | type --------------------------------------------------------------------- -(0 rows) +(N rows) RESET ROLE; -- Test Force Row Level Security, should also apply RLS to table owner @@ -123,14 +123,14 @@ SELECT * FROM events ORDER BY 1; --------------------------------------------------------------------- 1 | 1 | push 2 | 2 | push -(2 rows) +(N rows) -- Switch user to owner, no rows should be visible SET ROLE rls_table_owner; SELECT * FROM events ORDER BY 1; tenant_id | id | type --------------------------------------------------------------------- -(0 rows) +(N rows) RESET ROLE; -- Allow admins to read all rows @@ -142,7 +142,7 @@ SELECT * FROM events ORDER BY 1; --------------------------------------------------------------------- 1 | 1 | push 2 | 2 | push -(2 rows) +(N rows) -- Verify the owner can insert a record INSERT INTO events VALUES (3,3,'push'); @@ -153,7 +153,7 @@ SELECT * FROM events ORDER BY 1; 1 | 1 | push 2 | 2 | push 3 | 3 | push -(3 rows) +(N rows) -- Verify the owner can delete a record DELETE FROM events WHERE tenant_id = 3; @@ -163,7 +163,7 @@ SELECT * FROM events ORDER BY 1; --------------------------------------------------------------------- 1 | 1 | push 2 | 2 | push -(2 rows) +(N rows) RESET ROLE; -- Alter the policy and verify no rows are visible for admin @@ -173,7 +173,7 @@ SET ROLE rls_table_owner; SELECT * FROM events ORDER BY 1; tenant_id | id | type --------------------------------------------------------------------- -(0 rows) +(N rows) RESET ROLE; -- Test No Force Row Level Security, owner will not go through RLS anymore @@ -185,7 +185,7 @@ SELECT * FROM events ORDER BY 1; --------------------------------------------------------------------- 1 | 1 | push 2 | 2 | push -(2 rows) +(N rows) RESET ROLE; -- Disable row level security @@ -197,7 +197,7 @@ SELECT * FROM events ORDER BY 1; --------------------------------------------------------------------- 1 | 1 | push 2 | 2 | push -(2 rows) +(N rows) RESET ROLE; -- Clean up test @@ -226,7 +226,7 @@ SELECT * FROM events ORDER BY 1; --------------------------------------------------------------------- 1 | 1 | push 2 | 2 | push -(2 rows) +(N rows) -- Switch user that has been granted rights and read table SET ROLE rls_tenant_1; @@ -235,7 +235,7 @@ SELECT * FROM events ORDER BY 1; --------------------------------------------------------------------- 1 | 1 | push 2 | 2 | push -(2 rows) +(N rows) RESET ROLE; -- Enable row level security @@ -263,7 +263,7 @@ SELECT * FROM events ORDER BY 1; --------------------------------------------------------------------- 1 | 1 | push 2 | 2 | push -(2 rows) +(N rows) -- Verify owner cannot insert anything INSERT INTO events VALUES (3,3,'push'); @@ -279,7 +279,7 @@ SELECT * FROM events ORDER BY 1; --------------------------------------------------------------------- 1 | 1 | push 2 | 2 | push -(2 rows) +(N rows) RESET ROLE; -- Switch user that has been granted rights, should not be able to see any rows @@ -287,7 +287,7 @@ SET ROLE rls_tenant_1; SELECT * FROM events ORDER BY 1; tenant_id | id | type --------------------------------------------------------------------- -(0 rows) +(N rows) RESET ROLE; -- Create policy for tenants to read access their own rows @@ -325,7 +325,7 @@ SET ROLE rls_tenant_2; SELECT * FROM events ORDER BY 1; tenant_id | id | type --------------------------------------------------------------------- -(0 rows) +(N rows) RESET ROLE; ALTER POLICY user_mod ON events TO rls_tenant_1, rls_tenant_2; @@ -356,7 +356,7 @@ SELECT * FROM events ORDER BY 1; --------------------------------------------------------------------- 1 | 1 | push 2 | 2 | push -(2 rows) +(N rows) RESET ROLE; -- Disable row level security @@ -368,7 +368,7 @@ SELECT * FROM events ORDER BY 1; --------------------------------------------------------------------- 1 | 1 | push 2 | 2 | push -(2 rows) +(N rows) RESET ROLE; -- Clean up test @@ -397,7 +397,7 @@ SELECT * FROM events ORDER BY 1; --------------------------------------------------------------------- 1 | 1 | push 2 | 2 | push -(2 rows) +(N rows) -- Switch user that has been granted rights and read table SET ROLE rls_tenant_1; @@ -406,7 +406,7 @@ SELECT * FROM events ORDER BY 1; --------------------------------------------------------------------- 1 | 1 | push 2 | 2 | push -(2 rows) +(N rows) RESET ROLE; -- Configure FORCE and some policies before distribution @@ -430,7 +430,7 @@ SET ROLE rls_table_owner; SELECT * FROM events ORDER BY 1; tenant_id | id | type --------------------------------------------------------------------- -(0 rows) +(N rows) RESET ROLE; -- owner mod will only be set after distribution because it can test if FORCE has been @@ -443,7 +443,7 @@ SELECT * FROM events ORDER BY 1; --------------------------------------------------------------------- 1 | 1 | push 2 | 2 | push -(2 rows) +(N rows) RESET ROLE; -- Switch user that has been granted rights, should be able to see their own rows @@ -481,7 +481,7 @@ SELECT * FROM events ORDER BY 1; --------------------------------------------------------------------- 1 | 1 | push 2 | 2 | pull -(2 rows) +(N rows) -- allow all users to update their own values ALTER POLICY user_mod ON events WITH CHECK (true); @@ -497,7 +497,7 @@ SELECT * FROM events ORDER BY 1; --------------------------------------------------------------------- 1 | 1 | pull tenant 1 2 | 2 | pull tenant 2 -(2 rows) +(N rows) -- Clean up test DROP TABLE events; diff --git a/src/test/regress/expected/multi_cluster_management.out b/src/test/regress/expected/multi_cluster_management.out index 352a2ddfe..e7816bd62 100644 --- a/src/test/regress/expected/multi_cluster_management.out +++ b/src/test/regress/expected/multi_cluster_management.out @@ -54,7 +54,7 @@ SELECT result FROM run_command_on_workers('SELECT citus_is_coordinator()'); --------------------------------------------------------------------- f f -(2 rows) +(N rows) -- primary workers are primary node SELECT result FROM run_command_on_workers('SELECT citus_is_primary_node()'); @@ -62,7 +62,7 @@ SELECT result FROM run_command_on_workers('SELECT citus_is_primary_node()'); --------------------------------------------------------------------- t t -(2 rows) +(N rows) -- get the active nodes SELECT master_get_active_worker_nodes(); @@ -70,7 +70,7 @@ SELECT master_get_active_worker_nodes(); --------------------------------------------------------------------- (localhost,57638) (localhost,57637) -(2 rows) +(N rows) -- get all nodes SELECT * from citus_nodes; @@ -79,7 +79,7 @@ SELECT * from citus_nodes; localhost | 57637 | worker | t localhost | 57638 | worker | t localhost | 57636 | coordinator | t -(3 rows) +(N rows) -- get get active nodes SELECT * from citus_nodes where active = 't'; @@ -88,7 +88,7 @@ SELECT * from citus_nodes where active = 't'; localhost | 57637 | worker | t localhost | 57638 | worker | t localhost | 57636 | coordinator | t -(3 rows) +(N rows) -- get coordinator nodes SELECT * from citus_nodes where role = 'coordinator'; @@ -103,13 +103,13 @@ SELECT * from citus_nodes where role = 'worker'; --------------------------------------------------------------------- localhost | 57637 | worker | t localhost | 57638 | worker | t -(2 rows) +(N rows) -- get nodes with unknown role SELECT * from citus_nodes where role = 'foo'; nodename | nodeport | role | active --------------------------------------------------------------------- -(0 rows) +(N rows) -- try to add a node that is already in the cluster SELECT * FROM master_add_node('localhost', :worker_1_port); @@ -124,7 +124,7 @@ SELECT master_get_active_worker_nodes(); --------------------------------------------------------------------- (localhost,57638) (localhost,57637) -(2 rows) +(N rows) -- try to remove a node (with no placements) SELECT master_remove_node('localhost', :worker_2_port); @@ -171,7 +171,7 @@ SELECT * from citus_nodes where active = 't'; --------------------------------------------------------------------- localhost | 57636 | coordinator | t localhost | 57637 | worker | t -(2 rows) +(N rows) -- get get inactive nodes SELECT * from citus_nodes where active = 'f'; @@ -189,7 +189,7 @@ SELECT * FROM citus_nodes; localhost | 57636 | coordinator | t localhost | 57638 | worker | f localhost | 57637 | worker | t -(3 rows) +(N rows) SET ROLE postgres; DROP ROLE normaluser; @@ -206,7 +206,7 @@ ROLLBACK; SELECT * FROM get_rebalance_table_shards_plan(); table_name | shardid | shard_size | sourcename | sourceport | targetname | targetport --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT * FROM rebalance_table_shards(); rebalance_table_shards @@ -297,7 +297,7 @@ SELECT shardid, shardstate, nodename, nodeport FROM pg_dist_shard_placement WHER 1220011 | 1 | localhost | 57638 1220013 | 1 | localhost | 57638 1220015 | 1 | localhost | 57638 -(8 rows) +(N rows) -- try to remove a node with active placements and see that node removal is failed SELECT master_remove_node('localhost', :worker_2_port); @@ -309,7 +309,7 @@ SELECT master_get_active_worker_nodes(); --------------------------------------------------------------------- (localhost,57638) (localhost,57637) -(2 rows) +(N rows) -- insert a row so that citus_disable_node() exercises closing connections CREATE TABLE test_reference_table (y int primary key, name text); @@ -337,7 +337,7 @@ SELECT master_get_active_worker_nodes(); --------------------------------------------------------------------- (localhost,57638) (localhost,57637) -(2 rows) +(N rows) -- try to disable a node which does not exist and see that an error is thrown SELECT citus_disable_node('localhost.noexist', 2345); @@ -359,7 +359,7 @@ SELECT 1 FROM run_command_on_workers('CREATE USER node_metadata_user'); --------------------------------------------------------------------- 1 1 -(2 rows) +(N rows) RESET client_min_messages; GRANT EXECUTE ON FUNCTION master_activate_node(text,int) TO node_metadata_user; @@ -376,28 +376,28 @@ SELECT run_command_on_workers('GRANT ALL ON pg_dist_node TO node_metadata_user') --------------------------------------------------------------------- (localhost,57637,t,GRANT) (localhost,57638,t,GRANT) -(2 rows) +(N rows) SELECT run_command_on_workers('GRANT ALL ON pg_dist_local_group TO node_metadata_user'); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,GRANT) (localhost,57638,t,GRANT) -(2 rows) +(N rows) SELECT run_command_on_workers('GRANT ALL ON ALL TABLES IN SCHEMA citus TO node_metadata_user'); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,GRANT) (localhost,57638,t,GRANT) -(2 rows) +(N rows) SELECT run_command_on_workers('GRANT ALL ON SCHEMA citus TO node_metadata_user'); run_command_on_workers --------------------------------------------------------------------- (localhost,57637,t,GRANT) (localhost,57638,t,GRANT) -(2 rows) +(N rows) SELECT master_remove_node('localhost', :worker_2_port); master_remove_node @@ -451,7 +451,7 @@ SELECT 1 FROM master_add_secondary_node('localhost', :worker_2_port + 2, 'localh SELECT master_update_node(nodeid, 'localhost', :worker_2_port + 3) FROM pg_dist_node WHERE nodeport = :worker_2_port; master_update_node --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT nodename, nodeport, noderole FROM pg_dist_node ORDER BY nodeport; nodename | nodeport | noderole @@ -459,7 +459,7 @@ SELECT nodename, nodeport, noderole FROM pg_dist_node ORDER BY nodeport; localhost | 57636 | primary localhost | 57637 | primary localhost | 57640 | secondary -(3 rows) +(N rows) ABORT; \c - postgres - :master_port @@ -502,7 +502,7 @@ SELECT run_command_on_workers('UPDATE pg_dist_placement SET shardstate=3 WHERE g --------------------------------------------------------------------- (localhost,57637,t,"UPDATE 8") (localhost,57638,t,"UPDATE 8") -(2 rows) +(N rows) SELECT shardid, shardstate, nodename, nodeport FROM pg_dist_shard_placement WHERE nodeport=:worker_2_port; shardid | shardstate | nodename | nodeport @@ -515,7 +515,7 @@ SELECT shardid, shardstate, nodename, nodeport FROM pg_dist_shard_placement WHER 1220011 | 3 | localhost | 57638 1220013 | 3 | localhost | 57638 1220015 | 3 | localhost | 57638 -(8 rows) +(N rows) -- try to remove a node with only inactive placements and see that removal still fails SELECT master_remove_node('localhost', :worker_2_port); @@ -527,7 +527,7 @@ SELECT master_get_active_worker_nodes(); --------------------------------------------------------------------- (localhost,57638) (localhost,57637) -(2 rows) +(N rows) -- clean-up SELECT 1 FROM master_add_node('localhost', :worker_2_port); @@ -542,7 +542,7 @@ SELECT run_command_on_workers('UPDATE pg_dist_placement SET shardstate=1 WHERE g --------------------------------------------------------------------- (localhost,57637,t,"UPDATE 8") (localhost,57638,t,"UPDATE 8") -(2 rows) +(N rows) -- when there is no primary we should get a pretty error UPDATE pg_dist_node SET noderole = 'secondary' WHERE nodeport=:worker_2_port; @@ -578,7 +578,7 @@ SELECT run_command_on_workers('UPDATE pg_dist_placement SET groupid = ' || :'new --------------------------------------------------------------------- (localhost,57637,t,"UPDATE 8") (localhost,57638,t,"UPDATE 0") -(2 rows) +(N rows) SELECT start_metadata_sync_to_node('localhost', :worker_2_port); start_metadata_sync_to_node @@ -642,7 +642,7 @@ SELECT master_remove_node('localhost', :worker_2_port); SELECT nodename, nodeport FROM pg_dist_node WHERE nodename='localhost' AND nodeport=:worker_2_port; nodename | nodeport --------------------------------------------------------------------- -(0 rows) +(N rows) \c - - - :master_port -- check that added nodes are not propagated to nodes without metadata @@ -663,7 +663,7 @@ SELECT 1 FROM master_add_node('localhost', :worker_2_port); SELECT nodename, nodeport FROM pg_dist_node WHERE nodename='localhost' AND nodeport=:worker_2_port; nodename | nodeport --------------------------------------------------------------------- -(0 rows) +(N rows) \c - - - :master_port -- check that removing two nodes in the same transaction works @@ -696,7 +696,7 @@ SELECT * FROM pg_dist_node ORDER BY nodeid; 3 | 0 | localhost | 57636 | default | t | t | primary | default | t | f 11 | 9 | localhost | 57637 | default | t | t | primary | default | t | t 12 | 10 | localhost | 57638 | default | t | t | primary | default | t | t -(3 rows) +(N rows) -- check that mixed add/remove node commands work fine inside transaction BEGIN; @@ -722,7 +722,7 @@ COMMIT; SELECT nodename, nodeport FROM pg_dist_node WHERE nodename='localhost' AND nodeport=:worker_2_port; nodename | nodeport --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT start_metadata_sync_to_node('localhost', :worker_1_port); start_metadata_sync_to_node @@ -770,7 +770,7 @@ SELECT master_remove_node(nodename, nodeport) FROM pg_dist_node; -(3 rows) +(N rows) SELECT citus_set_coordinator_host('localhost'); citus_set_coordinator_host @@ -820,7 +820,7 @@ SELECT col1, col2 FROM temp ORDER BY col1; --------------------------------------------------------------------- row1 | 1 row2 | 2 -(2 rows) +(N rows) SELECT count(*) @@ -1061,7 +1061,7 @@ SELECT start_metadata_sync_to_node(nodename, nodeport) FROM pg_dist_node WHERE i -(3 rows) +(N rows) RESET client_min_messages; SET citus.shard_replication_factor TO 1; @@ -1115,7 +1115,7 @@ WHERE logicalrelid = 'test_dist_colocated'::regclass GROUP BY nodeport ORDER BY --------------------------------------------------------------------- 57637 | 2 57638 | 2 -(2 rows) +(N rows) -- non colocated tables should not be placed on shouldhaveshards false nodes anymore SELECT nodeport, count(*) @@ -1145,7 +1145,7 @@ WHERE logicalrelid = 'test_ref'::regclass GROUP BY nodeport ORDER BY nodeport; 57636 | 1 57637 | 1 57638 | 1 -(3 rows) +(N rows) -- cleanup for next test DROP TABLE test_dist, test_ref, test_dist_colocated, test_dist_non_colocated, test_dist_colocated_with_non_colocated; @@ -1190,7 +1190,7 @@ WHERE logicalrelid = 'test_ref'::regclass GROUP BY nodeport ORDER BY nodeport; 57636 | 1 57637 | 1 57638 | 1 -(3 rows) +(N rows) SELECT * from master_set_node_property('localhost', :worker_2_port, 'shouldhaveshards', true); master_set_node_property @@ -1217,7 +1217,7 @@ WHERE logicalrelid = 'test_ref'::regclass GROUP BY nodeport ORDER BY nodeport; 57636 | 1 57637 | 1 57638 | 1 -(3 rows) +(N rows) SELECT create_distributed_table('test_dist_colocated', 'x'); create_distributed_table @@ -1250,7 +1250,7 @@ WHERE logicalrelid = 'test_dist_non_colocated'::regclass GROUP BY nodeport ORDER --------------------------------------------------------------------- 57637 | 2 57638 | 2 -(2 rows) +(N rows) SELECT * from master_set_node_property('localhost', :worker_2_port, 'bogusproperty', false); ERROR: only the 'shouldhaveshards' property can be set using this function diff --git a/src/test/regress/expected/multi_create_role_dependency.out b/src/test/regress/expected/multi_create_role_dependency.out index df1792914..6dfe2c36d 100644 --- a/src/test/regress/expected/multi_create_role_dependency.out +++ b/src/test/regress/expected/multi_create_role_dependency.out @@ -26,7 +26,7 @@ SELECT * FROM run_command_on_workers($$SELECT pg_identify_object_as_address(clas --------------------------------------------------------------------- localhost | 57637 | t | (table,"{role_dependency_schema,non_super_user_table}",{}) localhost | 57638 | t | (table,"{role_dependency_schema,non_super_user_table}",{}) -(2 rows) +(N rows) SELECT pg_identify_object_as_address(classid, objid, objsubid) from pg_catalog.pg_dist_object where pg_identify_object_as_address(classid, objid, objsubid)::text like '%superusers_type%'; pg_identify_object_as_address @@ -39,7 +39,7 @@ SELECT * FROM run_command_on_workers($$SELECT pg_identify_object_as_address(clas --------------------------------------------------------------------- localhost | 57637 | t | (type,{role_dependency_schema.superusers_type},{}) localhost | 57638 | t | (type,{role_dependency_schema.superusers_type},{}) -(2 rows) +(N rows) DROP SCHEMA role_dependency_schema CASCADE; NOTICE: drop cascades to 2 other objects diff --git a/src/test/regress/expected/multi_create_table.out b/src/test/regress/expected/multi_create_table.out index 61c3c8fe1..69d5ed8a4 100644 --- a/src/test/regress/expected/multi_create_table.out +++ b/src/test/regress/expected/multi_create_table.out @@ -215,7 +215,7 @@ SELECT * FROM data_load_test ORDER BY col1; --------------------------------------------------------------------- 132 | hello | 1 243 | world | 2 -(2 rows) +(N rows) DROP TABLE data_load_test; -- test queries on distributed tables with no shards @@ -229,7 +229,7 @@ SELECT create_distributed_table('no_shard_test', 'col1', 'append'); SELECT * FROM no_shard_test WHERE col1 > 1; col1 | col2 --------------------------------------------------------------------- -(0 rows) +(N rows) DROP TABLE no_shard_test; CREATE TABLE no_shard_test (col1 int, col2 text); @@ -242,7 +242,7 @@ SELECT create_distributed_table('no_shard_test', 'col1', 'range'); SELECT * FROM no_shard_test WHERE col1 > 1; col1 | col2 --------------------------------------------------------------------- -(0 rows) +(N rows) DROP TABLE no_shard_test; -- ensure writes in the same transaction as create_distributed_table are visible @@ -266,7 +266,7 @@ SELECT * FROM data_load_test ORDER BY col1; --------------------------------------------------------------------- 132 | hello | 1 243 | world | 2 -(2 rows) +(N rows) DROP TABLE data_load_test; -- creating co-located distributed tables in the same transaction works diff --git a/src/test/regress/expected/multi_create_table_superuser.out b/src/test/regress/expected/multi_create_table_superuser.out index 1f756d688..de297592b 100644 --- a/src/test/regress/expected/multi_create_table_superuser.out +++ b/src/test/regress/expected/multi_create_table_superuser.out @@ -37,7 +37,7 @@ ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 360025; SELECT relname FROM pg_class WHERE relname LIKE 'data_load_test%'; relname --------------------------------------------------------------------- -(0 rows) +(N rows) \c - - :master_host :master_port -- creating an index after loading data works @@ -110,7 +110,7 @@ SELECT * FROM data_load_test ORDER BY col2; --------------------------------------------------------------------- hello | world | world | hello | -(2 rows) +(N rows) -- make sure the tuple went to the right shard SELECT * FROM data_load_test WHERE col3 = 'world'; @@ -152,7 +152,7 @@ SELECT * FROM master_get_table_ddl_events('unlogged_table'); --------------------------------------------------------------------- CREATE UNLOGGED TABLE public.unlogged_table (key text, value text) USING heap ALTER TABLE public.unlogged_table OWNER TO postgres -(2 rows) +(N rows) \c - - :public_worker_1_host :worker_1_port SELECT relpersistence FROM pg_class WHERE relname LIKE 'unlogged_table_%'; @@ -162,7 +162,7 @@ SELECT relpersistence FROM pg_class WHERE relname LIKE 'unlogged_table_%'; u u u -(4 rows) +(N rows) \c - - :master_host :master_port -- Test rollback of create table @@ -180,7 +180,7 @@ ROLLBACK; SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid = (SELECT oid FROM pg_class WHERE relname LIKE 'rollback_table%'); Column | Type | Modifiers --------------------------------------------------------------------- -(0 rows) +(N rows) \c - - :master_host :master_port -- Insert 3 rows to make sure that copy after shard creation touches the same @@ -206,7 +206,7 @@ ROLLBACK; SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid = (SELECT oid FROM pg_class WHERE relname LIKE 'rollback_table%'); Column | Type | Modifiers --------------------------------------------------------------------- -(0 rows) +(N rows) \c - - :master_host :master_port BEGIN; @@ -243,7 +243,7 @@ ROLLBACK; SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid = (SELECT oid FROM pg_class WHERE relname LIKE 'rollback_table%'); Column | Type | Modifiers --------------------------------------------------------------------- -(0 rows) +(N rows) \c - - :master_host :master_port BEGIN; @@ -312,7 +312,7 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid = 'public.appen SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid = (SELECT oid from pg_class WHERE relname LIKE 'public.tt1%'); Column | Type | Modifiers --------------------------------------------------------------------- -(0 rows) +(N rows) \c - - :master_host :master_port -- Queries executing with router executor is allowed in the same transaction @@ -363,7 +363,7 @@ COMMIT; SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid = (SELECT oid from pg_class WHERE relname LIKE 'tt1%'); Column | Type | Modifiers --------------------------------------------------------------------- -(0 rows) +(N rows) \c - - :master_host :master_port -- Tests with create_distributed_table & DDL & DML commands @@ -525,7 +525,7 @@ SELECT run_command_on_workers($$SELECT relreplident FROM pg_class join informati --------------------------------------------------------------------- (localhost,57637,t,i) (localhost,57638,t,i) -(2 rows) +(N rows) BEGIN; CREATE SCHEMA sc4; @@ -553,7 +553,7 @@ SELECT run_command_on_workers($$SELECT relreplident FROM pg_class join informati --------------------------------------------------------------------- (localhost,57637,t,i) (localhost,57638,t,i) -(2 rows) +(N rows) SET search_path = 'public'; BEGIN; @@ -581,7 +581,7 @@ SELECT run_command_on_workers($$SELECT relreplident FROM pg_class join informati --------------------------------------------------------------------- (localhost,57637,t,f) (localhost,57638,t,f) -(2 rows) +(N rows) BEGIN; CREATE SCHEMA sc6; @@ -609,7 +609,7 @@ SELECT run_command_on_workers($$SELECT relreplident FROM pg_class join informati --------------------------------------------------------------------- (localhost,57637,t,i) (localhost,57638,t,i) -(2 rows) +(N rows) BEGIN; CREATE TABLE alter_replica_table @@ -636,7 +636,7 @@ SELECT run_command_on_workers($$SELECT relreplident FROM pg_class join informati --------------------------------------------------------------------- (localhost,57637,t,i) (localhost,57638,t,i) -(2 rows) +(N rows) DROP TABLE tt1; DROP TABLE tt2; diff --git a/src/test/regress/expected/multi_data_types.out b/src/test/regress/expected/multi_data_types.out index a88f9e1de..99a3c9d67 100644 --- a/src/test/regress/expected/multi_data_types.out +++ b/src/test/regress/expected/multi_data_types.out @@ -181,7 +181,7 @@ INSERT INTO composite_type_partitioned_table VALUES (123, '(123, 456)'::other_co Node: host=localhost port=xxxxx dbname=regression -> Insert on composite_type_partitioned_table_530003 (actual rows=0 loops=1) -> Result (actual rows=1 loops=1) -(7 rows) +(N rows) SELECT run_command_on_coordinator_and_workers($cf$ DROP CAST (other_composite_type as test_composite_type); @@ -223,7 +223,7 @@ INSERT INTO composite_type_partitioned_table VALUES (123, '(456, 678)'::other_co Node: host=localhost port=xxxxx dbname=regression -> Insert on composite_type_partitioned_table_530000 (actual rows=0 loops=1) -> Result (actual rows=1 loops=1) -(7 rows) +(N rows) -- create and distribute a table on enum type column CREATE TYPE bug_status AS ENUM ('new', 'open', 'closed'); @@ -248,7 +248,7 @@ SELECT * FROM bugs WHERE status = 'closed'::bug_status; --------------------------------------------------------------------- 3 | closed 4 | closed -(2 rows) +(N rows) UPDATE bugs SET status = 'closed'::bug_status WHERE id = 2; ERROR: modifying the partition value of rows is not allowed @@ -257,7 +257,7 @@ SELECT * FROM bugs WHERE status = 'open'::bug_status; --------------------------------------------------------------------- 2 | open 5 | open -(2 rows) +(N rows) -- create and distribute a table on varchar column CREATE TABLE varchar_hash_partitioned_table diff --git a/src/test/regress/expected/multi_multiuser_auth.out b/src/test/regress/expected/multi_multiuser_auth.out index 6b0e85b67..2a8d90f29 100644 --- a/src/test/regress/expected/multi_multiuser_auth.out +++ b/src/test/regress/expected/multi_multiuser_auth.out @@ -92,7 +92,7 @@ SELECT o_orderstatus, sum(l_linenumber), avg(l_linenumber) FROM lineitem, orders --------------------------------------------------------------------- F | 8559 | 3.0126715945089757 O | 8904 | 3.0040485829959514 -(2 rows) +(N rows) -- fix worker passwords, which should invalidate task tracker caches \c - postgres - :worker_1_port @@ -113,7 +113,7 @@ SELECT o_orderstatus, sum(l_linenumber), avg(l_linenumber) FROM lineitem, orders --------------------------------------------------------------------- F | 8559 | 3.0126715945089757 O | 8904 | 3.0040485829959514 -(2 rows) +(N rows) -- adaptive query RESET citus.task_executor_type; @@ -126,7 +126,7 @@ SELECT o_orderstatus, sum(l_linenumber), avg(l_linenumber) FROM lineitem, orders --------------------------------------------------------------------- F | 8559 | 3.0126715945089757 O | 8904 | 3.0040485829959514 -(2 rows) +(N rows) -- create and distribute table CREATE TABLE wonderland (id integer, name text); diff --git a/src/test/regress/expected/multi_multiuser_basic_queries.out b/src/test/regress/expected/multi_multiuser_basic_queries.out index 4ef20340d..f544c783a 100644 --- a/src/test/regress/expected/multi_multiuser_basic_queries.out +++ b/src/test/regress/expected/multi_multiuser_basic_queries.out @@ -88,7 +88,7 @@ LIMIT 30; 864 | 3175 | 1 960 | 10980 | 1 963 | 4580 | 1 -(20 rows) +(N rows) RESET ROLE; SET ROLE no_access; @@ -151,7 +151,7 @@ LIMIT 30; 864 | 3175 | 1 960 | 10980 | 1 963 | 4580 | 1 -(20 rows) +(N rows) RESET ROLE; SET ROLE no_access; diff --git a/src/test/regress/expected/multi_multiuser_grant.out b/src/test/regress/expected/multi_multiuser_grant.out index 9edb78c9d..828de76e2 100644 --- a/src/test/regress/expected/multi_multiuser_grant.out +++ b/src/test/regress/expected/multi_multiuser_grant.out @@ -20,7 +20,7 @@ SET ROLE full_access; SELECT oid, relname, relacl FROM pg_class WHERE relkind = 'r' AND relname LIKE 'customer_%' AND has_table_privilege(oid, 'SELECT'); oid | relname | relacl --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT count(*) FROM pg_class WHERE relkind = 'r' AND relname LIKE 'customer_%' AND NOT has_table_privilege(oid, 'SELECT'); count @@ -45,7 +45,7 @@ SET ROLE full_access; SELECT oid, relname, relacl FROM pg_class WHERE relkind = 'r' AND relname LIKE 'customer_%' AND has_table_privilege(oid, 'SELECT'); oid | relname | relacl --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT count(*) FROM pg_class WHERE relkind = 'r' AND relname LIKE 'customer_%' AND NOT has_table_privilege(oid, 'SELECT'); count diff --git a/src/test/regress/expected/multi_multiuser_master_protocol.out b/src/test/regress/expected/multi_multiuser_master_protocol.out index 422d30858..28126b071 100644 --- a/src/test/regress/expected/multi_multiuser_master_protocol.out +++ b/src/test/regress/expected/multi_multiuser_master_protocol.out @@ -38,7 +38,7 @@ SELECT * FROM master_get_table_ddl_events('lineitem') order by 1; GRANT UPDATE ON public.lineitem TO full_access GRANT UPDATE ON public.lineitem TO postgres REVOKE ALL ON public.lineitem FROM PUBLIC -(22 rows) +(N rows) SELECT * FROM master_get_new_shardid(); master_get_new_shardid @@ -51,7 +51,7 @@ SELECT * FROM master_get_active_worker_nodes(); --------------------------------------------------------------------- localhost | 57638 localhost | 57637 -(2 rows) +(N rows) RESET ROLE; -- ensure GRANT/REVOKE's do something sane for creating shards of @@ -67,7 +67,7 @@ SELECT * FROM master_get_table_ddl_events('checkperm'); --------------------------------------------------------------------- CREATE TABLE public.checkperm (key integer) USING heap ALTER TABLE public.checkperm OWNER TO postgres -(2 rows) +(N rows) REVOKE ALL ON checkperm FROM PUBLIC; SELECT * FROM master_get_table_ddl_events('checkperm'); @@ -84,7 +84,7 @@ SELECT * FROM master_get_table_ddl_events('checkperm'); GRANT TRIGGER ON public.checkperm TO postgres GRANT MAINTAIN ON public.checkperm TO postgres ALTER TABLE public.checkperm OWNER TO postgres -(11 rows) +(N rows) GRANT SELECT ON checkperm TO read_access; GRANT ALL ON checkperm TO full_access; @@ -111,7 +111,7 @@ SELECT * FROM master_get_table_ddl_events('checkperm'); GRANT TRIGGER ON public.checkperm TO full_access GRANT MAINTAIN ON public.checkperm TO full_access ALTER TABLE public.checkperm OWNER TO postgres -(20 rows) +(N rows) REVOKE ALL ON checkperm FROM read_access; GRANT SELECT ON checkperm TO PUBLIC; @@ -138,7 +138,7 @@ SELECT * FROM master_get_table_ddl_events('checkperm'); GRANT MAINTAIN ON public.checkperm TO full_access GRANT SELECT ON public.checkperm TO PUBLIC ALTER TABLE public.checkperm OWNER TO postgres -(20 rows) +(N rows) GRANT ALL ON checkperm TO full_access WITH GRANT OPTION; SELECT * FROM master_get_table_ddl_events('checkperm'); @@ -164,7 +164,7 @@ SELECT * FROM master_get_table_ddl_events('checkperm'); GRANT MAINTAIN ON public.checkperm TO full_access WITH GRANT OPTION GRANT SELECT ON public.checkperm TO PUBLIC ALTER TABLE public.checkperm OWNER TO postgres -(20 rows) +(N rows) -- create table as superuser/postgres CREATE TABLE trivial_postgres (id int); @@ -190,7 +190,7 @@ SELECT relname, rolname, relacl FROM pg_class JOIN pg_roles ON (pg_roles.oid = p --------------------------------------------------------------------- trivial_full_access | full_access | trivial_postgres | postgres | {postgres=arwdDxtm/postgres,full_access=arwdDxtm/postgres} -(2 rows) +(N rows) SET citus.shard_replication_factor = 2; -- on all workers... -- create shards as each user, verify ownership @@ -244,7 +244,7 @@ SELECT relname, rolname, relacl FROM pg_class JOIN pg_roles ON (pg_roles.oid = p trivial_postgres_109080 | postgres | {postgres=arwdDxtm/postgres,full_access=arwdDxtm/postgres} trivial_postgres_109082 | postgres | {postgres=arwdDxtm/postgres,full_access=arwdDxtm/postgres} trivial_postgres_109084 | postgres | {postgres=arwdDxtm/postgres,full_access=arwdDxtm/postgres} -(6 rows) +(N rows) \c - - - :worker_2_port SELECT relname, rolname, relacl FROM pg_class JOIN pg_roles ON (pg_roles.oid = pg_class.relowner) WHERE relname LIKE 'trivial%' ORDER BY relname; @@ -256,7 +256,7 @@ SELECT relname, rolname, relacl FROM pg_class JOIN pg_roles ON (pg_roles.oid = p trivial_postgres_109080 | postgres | {postgres=arwdDxtm/postgres,full_access=arwdDxtm/postgres} trivial_postgres_109082 | postgres | {postgres=arwdDxtm/postgres,full_access=arwdDxtm/postgres} trivial_postgres_109084 | postgres | {postgres=arwdDxtm/postgres,full_access=arwdDxtm/postgres} -(6 rows) +(N rows) \c - - - :master_port -- ensure COPY into append tables works @@ -282,7 +282,7 @@ SELECT * FROM trivial_postgres ORDER BY id; 1 2 2 -(4 rows) +(N rows) SELECT * FROM trivial_full_access ORDER BY id; id @@ -291,7 +291,7 @@ SELECT * FROM trivial_full_access ORDER BY id; 1 2 2 -(4 rows) +(N rows) SET ROLE full_access; SELECT * FROM trivial_postgres ORDER BY id; @@ -301,7 +301,7 @@ SELECT * FROM trivial_postgres ORDER BY id; 1 2 2 -(4 rows) +(N rows) SELECT * FROM trivial_full_access ORDER BY id; id @@ -310,7 +310,7 @@ SELECT * FROM trivial_full_access ORDER BY id; 1 2 2 -(4 rows) +(N rows) RESET ROLE; -- verify column level grants are supported @@ -341,7 +341,7 @@ ORDER BY nodename, nodeport, shardid; localhost | 57637 | 109092 | t | f localhost | 57638 | 109091 | t | f localhost | 57638 | 109093 | t | f -(4 rows) +(N rows) -- grant select GRANT SELECT ON ALL TABLES IN SCHEMA multiuser_schema TO read_access; @@ -354,7 +354,7 @@ ORDER BY nodename, nodeport, shardid; localhost | 57637 | 109092 | t | t localhost | 57638 | 109091 | t | t localhost | 57638 | 109093 | t | t -(4 rows) +(N rows) -- distribute the second table SELECT create_reference_table('multiuser_schema.reference_table'); @@ -371,7 +371,7 @@ ORDER BY nodename, nodeport, shardid; localhost | 57636 | 109094 | t | t localhost | 57637 | 109094 | t | t localhost | 57638 | 109094 | t | t -(3 rows) +(N rows) -- create another table in the schema, verify select is not granted CREATE TABLE multiuser_schema.another_table(a int, b int); @@ -389,7 +389,7 @@ ORDER BY nodename, nodeport, shardid; localhost | 57637 | 109097 | t | f localhost | 57638 | 109096 | t | f localhost | 57638 | 109098 | t | f -(4 rows) +(N rows) -- grant select again, verify it is granted GRANT SELECT ON ALL TABLES IN SCHEMA multiuser_schema TO read_access; @@ -401,7 +401,7 @@ ORDER BY nodename, nodeport, shardid; localhost | 57637 | 109097 | t | t localhost | 57638 | 109096 | t | t localhost | 57638 | 109098 | t | t -(4 rows) +(N rows) -- verify isolate tenant carries grants SELECT isolate_tenant_to_new_shard('multiuser_schema.hash_table', 5, shard_transfer_mode => 'block_writes'); @@ -420,7 +420,7 @@ ORDER BY nodename, nodeport, shardid; localhost | 57637 | 109101 | t | t localhost | 57638 | 109091 | t | t localhost | 57638 | 109093 | t | t -(6 rows) +(N rows) -- revoke select REVOKE SELECT ON ALL TABLES IN SCHEMA multiuser_schema FROM read_access; @@ -434,7 +434,7 @@ ORDER BY nodename, nodeport, shardid; localhost | 57637 | 109101 | t | f localhost | 57638 | 109091 | t | f localhost | 57638 | 109093 | t | f -(6 rows) +(N rows) -- test multi-schema grants CREATE SCHEMA multiuser_second_schema; @@ -456,7 +456,7 @@ ORDER BY nodename, nodeport, shardid; localhost | 57637 | 109101 | t | t localhost | 57638 | 109091 | t | t localhost | 57638 | 109093 | t | t -(6 rows) +(N rows) SELECT * FROM run_command_on_placements('multiuser_second_schema.hash_table', $$ select has_table_privilege('read_access', '%s', 'select') $$) ORDER BY nodename, nodeport, shardid; @@ -468,7 +468,7 @@ ORDER BY nodename, nodeport, shardid; localhost | 57637 | 109106 | t | t localhost | 57638 | 109105 | t | t localhost | 57638 | 109107 | t | t -(6 rows) +(N rows) -- revoke from multiple schemas, verify result REVOKE SELECT ON ALL TABLES IN SCHEMA multiuser_schema, multiuser_second_schema FROM read_access; @@ -482,7 +482,7 @@ ORDER BY nodename, nodeport, shardid; localhost | 57637 | 109101 | t | f localhost | 57638 | 109091 | t | f localhost | 57638 | 109093 | t | f -(6 rows) +(N rows) SELECT * FROM run_command_on_placements('multiuser_second_schema.hash_table', $$ select has_table_privilege('read_access', '%s', 'select') $$) ORDER BY nodename, nodeport, shardid; @@ -494,7 +494,7 @@ ORDER BY nodename, nodeport, shardid; localhost | 57637 | 109106 | t | f localhost | 57638 | 109105 | t | f localhost | 57638 | 109107 | t | f -(6 rows) +(N rows) DROP SCHEMA multiuser_schema CASCADE; NOTICE: drop cascades to 4 other objects diff --git a/src/test/regress/expected/multi_tenant_isolation.out b/src/test/regress/expected/multi_tenant_isolation.out index 5af7acac8..c04e93855 100644 --- a/src/test/regress/expected/multi_tenant_isolation.out +++ b/src/test/regress/expected/multi_tenant_isolation.out @@ -100,7 +100,7 @@ ORDER BY 99 | 109604.3256 | 03-13-1994 -1995148554 | 16890.6816 | 05-08-1995 -1686493264 | 1988.7134 | 09-05-1997 -(7 rows) +(N rows) -- Checks to see if metadata and data are isolated properly. If there are problems in -- metadata and/or data on workers, these queries should return different results below @@ -174,7 +174,7 @@ SELECT * FROM pg_dist_shard orders_streaming | 1230002 | t | -2147483648 | -1 lineitem_streaming | 1230001 | t | 0 | 2147483647 orders_streaming | 1230003 | t | 0 | 2147483647 -(4 rows) +(N rows) -- check without cascade option SELECT isolate_tenant_to_new_shard('lineitem_streaming', 100, shard_transfer_mode => 'block_writes'); @@ -207,7 +207,7 @@ EXPLAIN (COSTS false) SELECT count(*) FROM lineitem_streaming WHERE l_orderkey = -> Aggregate -> Seq Scan on lineitem_streaming_1230011 lineitem_streaming Filter: (l_orderkey = 101) -(8 rows) +(N rows) -- create an MX node \c - postgres - :master_port @@ -322,7 +322,7 @@ ORDER BY 99 | 109604.3256 | 03-13-1994 -1995148554 | 16890.6816 | 05-08-1995 -1686493264 | 1988.7134 | 09-05-1997 -(7 rows) +(N rows) SELECT count(*) FROM lineitem_streaming WHERE l_orderkey = 99; count @@ -413,7 +413,7 @@ SELECT * FROM pg_dist_shard orders_streaming | 1230046 | t | 412880113 | 2147483646 lineitem_streaming | 1230045 | t | 2147483647 | 2147483647 orders_streaming | 1230047 | t | 2147483647 | 2147483647 -(24 rows) +(N rows) SELECT * FROM pg_dist_shard_placement WHERE shardid BETWEEN 1230000 AND 1399999 ORDER BY nodeport, shardid; shardid | shardstate | shardlength | nodename | nodeport | placementid @@ -442,7 +442,7 @@ SELECT * FROM pg_dist_shard_placement WHERE shardid BETWEEN 1230000 AND 1399999 1230045 | 1 | 0 | localhost | 57638 | 100045 1230046 | 1 | 0 | localhost | 57638 | 100046 1230047 | 1 | 0 | localhost | 57638 | 100047 -(24 rows) +(N rows) -- test failing foreign constraints after multiple tenant isolation \COPY lineitem_streaming FROM STDIN WITH DELIMITER '|' @@ -495,7 +495,7 @@ ORDER BY 99 | 109604.3256 | 03-13-1994 -1995148554 | 16890.6816 | 05-08-1995 -1686493264 | 1988.7134 | 09-05-1997 -(7 rows) +(N rows) -- check shards SET citus.override_table_visibility TO false; @@ -517,7 +517,7 @@ SET citus.override_table_visibility TO false; Tenant Isolation | orders_streaming_1230039 | table | mx_isolation_role_ent Tenant Isolation | orders_streaming_1230042 | table | mx_isolation_role_ent Tenant Isolation | orders_streaming_1230043 | table | mx_isolation_role_ent -(14 rows) +(N rows) \c - postgres - :worker_1_port SET search_path to "Tenant Isolation"; @@ -533,7 +533,7 @@ SELECT "Column", "Type", "Modifiers" FROM public.table_desc WHERE relid='orders_ o_clerk | character(15) | not null o_shippriority | integer | not null o_comment | character varying(79) | not null -(9 rows) +(N rows) \c - mx_isolation_role_ent - :worker_1_port SET search_path to "Tenant Isolation"; @@ -567,7 +567,7 @@ SELECT * FROM pg_dist_shard orders_streaming | 1230046 | t | 412880113 | 2147483646 lineitem_streaming | 1230045 | t | 2147483647 | 2147483647 orders_streaming | 1230047 | t | 2147483647 | 2147483647 -(24 rows) +(N rows) -- return to master node \c - mx_isolation_role_ent - :master_port @@ -710,7 +710,7 @@ SELECT * FROM pg_dist_shard orders_streaming | 1230046 | t | 412880113 | 2147483646 lineitem_streaming | 1230045 | t | 2147483647 | 2147483647 orders_streaming | 1230047 | t | 2147483647 | 2147483647 -(24 rows) +(N rows) \c - postgres - :master_port SELECT public.wait_for_resource_cleanup(); @@ -753,7 +753,7 @@ SET citus.override_table_visibility TO false; Tenant Isolation | orders_streaming_1230039 | table | mx_isolation_role_ent Tenant Isolation | orders_streaming_1230042 | table | mx_isolation_role_ent Tenant Isolation | orders_streaming_1230043 | table | mx_isolation_role_ent -(14 rows) +(N rows) \c - mx_isolation_role_ent - :master_port SET search_path to "Tenant Isolation"; @@ -782,7 +782,7 @@ SET citus.override_table_visibility TO false; Tenant Isolation | orders_streaming_1230039 | table | mx_isolation_role_ent Tenant Isolation | orders_streaming_1230042 | table | mx_isolation_role_ent Tenant Isolation | orders_streaming_1230043 | table | mx_isolation_role_ent -(14 rows) +(N rows) DROP EVENT TRIGGER abort_ddl; -- create a trigger for drops @@ -839,7 +839,7 @@ ORDER BY 99 | 109604.3256 | 03-13-1994 -1995148554 | 16890.6816 | 05-08-1995 -1686493264 | 1988.7134 | 09-05-1997 -(7 rows) +(N rows) SELECT count(*) FROM lineitem_streaming WHERE l_orderkey = 99; count @@ -1079,7 +1079,7 @@ ORDER BY 1, 2; test_colocated_table_3_1230093 | test_colocated_table_3_id_fkey1_1230093 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230090(id) test_colocated_table_3_1230093 | test_colocated_table_3_id_fkey_1230093 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230087(id) test_colocated_table_3_1230093 | test_colocated_table_3_value_1_fkey_1230093 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230060(id) -(42 rows) +(N rows) \c - mx_isolation_role_ent - :master_port SET search_path to "Tenant Isolation"; diff --git a/src/test/regress/expected/multi_tenant_isolation_nonblocking.out b/src/test/regress/expected/multi_tenant_isolation_nonblocking.out index 3daac7dac..251a892e8 100644 --- a/src/test/regress/expected/multi_tenant_isolation_nonblocking.out +++ b/src/test/regress/expected/multi_tenant_isolation_nonblocking.out @@ -100,7 +100,7 @@ ORDER BY 99 | 109604.3256 | 03-13-1994 -1995148554 | 16890.6816 | 05-08-1995 -1686493264 | 1988.7134 | 09-05-1997 -(7 rows) +(N rows) -- Checks to see if metadata and data are isolated properly. If there are problems in -- metadata and/or data on workers, these queries should return different results below @@ -174,7 +174,7 @@ SELECT * FROM pg_dist_shard orders_streaming | 1230002 | t | -2147483648 | -1 lineitem_streaming | 1230001 | t | 0 | 2147483647 orders_streaming | 1230003 | t | 0 | 2147483647 -(4 rows) +(N rows) -- check without cascade option SELECT isolate_tenant_to_new_shard('lineitem_streaming', 100, shard_transfer_mode => 'force_logical'); @@ -207,7 +207,7 @@ EXPLAIN (COSTS false) SELECT count(*) FROM lineitem_streaming WHERE l_orderkey = -> Aggregate -> Seq Scan on lineitem_streaming_1230011 lineitem_streaming Filter: (l_orderkey = 101) -(8 rows) +(N rows) -- create an MX node \c - postgres - :master_port @@ -334,7 +334,7 @@ ORDER BY 99 | 109604.3256 | 03-13-1994 -1995148554 | 16890.6816 | 05-08-1995 -1686493264 | 1988.7134 | 09-05-1997 -(7 rows) +(N rows) SELECT count(*) FROM lineitem_streaming WHERE l_orderkey = 99; count @@ -425,7 +425,7 @@ SELECT * FROM pg_dist_shard orders_streaming | 1230046 | t | 412880113 | 2147483646 lineitem_streaming | 1230045 | t | 2147483647 | 2147483647 orders_streaming | 1230047 | t | 2147483647 | 2147483647 -(24 rows) +(N rows) SELECT * FROM pg_dist_shard_placement WHERE shardid BETWEEN 1230000 AND 1399999 ORDER BY nodeport, shardid; shardid | shardstate | shardlength | nodename | nodeport | placementid @@ -454,7 +454,7 @@ SELECT * FROM pg_dist_shard_placement WHERE shardid BETWEEN 1230000 AND 1399999 1230045 | 1 | 0 | localhost | 57638 | 100045 1230046 | 1 | 0 | localhost | 57638 | 100046 1230047 | 1 | 0 | localhost | 57638 | 100047 -(24 rows) +(N rows) -- test failing foreign constraints after multiple tenant isolation \COPY lineitem_streaming FROM STDIN WITH DELIMITER '|' @@ -507,7 +507,7 @@ ORDER BY 99 | 109604.3256 | 03-13-1994 -1995148554 | 16890.6816 | 05-08-1995 -1686493264 | 1988.7134 | 09-05-1997 -(7 rows) +(N rows) -- check shards SET citus.override_table_visibility TO false; @@ -529,7 +529,7 @@ SET citus.override_table_visibility TO false; Tenant Isolation | orders_streaming_1230039 | table | mx_isolation_role_ent Tenant Isolation | orders_streaming_1230042 | table | mx_isolation_role_ent Tenant Isolation | orders_streaming_1230043 | table | mx_isolation_role_ent -(14 rows) +(N rows) \c - postgres - :worker_1_port SET search_path to "Tenant Isolation"; @@ -545,7 +545,7 @@ SELECT "Column", "Type", "Modifiers" FROM public.table_desc WHERE relid='orders_ o_clerk | character(15) | not null o_shippriority | integer | not null o_comment | character varying(79) | not null -(9 rows) +(N rows) \c - mx_isolation_role_ent - :worker_1_port SET search_path to "Tenant Isolation"; @@ -579,7 +579,7 @@ SELECT * FROM pg_dist_shard orders_streaming | 1230046 | t | 412880113 | 2147483646 lineitem_streaming | 1230045 | t | 2147483647 | 2147483647 orders_streaming | 1230047 | t | 2147483647 | 2147483647 -(24 rows) +(N rows) -- return to master node \c - mx_isolation_role_ent - :master_port @@ -754,7 +754,7 @@ SELECT * FROM pg_dist_shard orders_streaming | 1230046 | t | 412880113 | 2147483646 lineitem_streaming | 1230045 | t | 2147483647 | 2147483647 orders_streaming | 1230047 | t | 2147483647 | 2147483647 -(24 rows) +(N rows) \c - postgres - :master_port SELECT public.wait_for_resource_cleanup(); @@ -801,7 +801,7 @@ SET citus.override_table_visibility TO false; Tenant Isolation | text_column_1230052 | table | mx_isolation_role_ent Tenant Isolation | text_column_1230053 | table | mx_isolation_role_ent Tenant Isolation | text_column_1230054 | table | mx_isolation_role_ent -(18 rows) +(N rows) \c - mx_isolation_role_ent - :master_port SET search_path to "Tenant Isolation"; @@ -834,7 +834,7 @@ SET citus.override_table_visibility TO false; Tenant Isolation | text_column_1230052 | table | mx_isolation_role_ent Tenant Isolation | text_column_1230053 | table | mx_isolation_role_ent Tenant Isolation | text_column_1230054 | table | mx_isolation_role_ent -(18 rows) +(N rows) DROP EVENT TRIGGER abort_ddl; \c - mx_isolation_role_ent - :master_port @@ -876,7 +876,7 @@ ORDER BY 99 | 109604.3256 | 03-13-1994 -1995148554 | 16890.6816 | 05-08-1995 -1686493264 | 1988.7134 | 09-05-1997 -(7 rows) +(N rows) SELECT count(*) FROM lineitem_streaming WHERE l_orderkey = 99; count @@ -1126,7 +1126,7 @@ ORDER BY 1, 2; test_colocated_table_3_1230106 | test_colocated_table_3_id_fkey1_1230106 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_2_1230103(id) test_colocated_table_3_1230106 | test_colocated_table_3_id_fkey_1230106 | FOREIGN KEY (id) REFERENCES "Tenant Isolation".test_colocated_table_1_1230100(id) test_colocated_table_3_1230106 | test_colocated_table_3_value_1_fkey_1230106 | FOREIGN KEY (value_1) REFERENCES "Tenant Isolation".test_reference_table_fkey_1230065(id) -(42 rows) +(N rows) \c - mx_isolation_role_ent - :master_port SET search_path to "Tenant Isolation"; diff --git a/src/test/regress/expected/publication.out b/src/test/regress/expected/publication.out index d4dd2565a..523dda48a 100644 --- a/src/test/regress/expected/publication.out +++ b/src/test/regress/expected/publication.out @@ -70,7 +70,7 @@ SELECT DISTINCT c FROM ( SELECT worker_create_or_replace_object('CREATE PUBLICATION "pub-all-insertupdateonly" FOR ALL TABLES WITH (publish_via_partition_root = ''false'', publish = ''insert, update'')'); SELECT worker_create_or_replace_object('CREATE PUBLICATION pubempty WITH (publish_via_partition_root = ''false'', publish = ''insert, update, delete, truncate'')'); SELECT worker_create_or_replace_object('CREATE PUBLICATION pubinsertonly WITH (publish_via_partition_root = ''false'', publish = ''insert'')'); -(4 rows) +(N rows) CREATE TABLE test (x int primary key, y int, "column-1" int, doc xml); CREATE TABLE "test-pubs" (x int primary key, y int, "column-1" int); diff --git a/src/test/regress/expected/publication_0.out b/src/test/regress/expected/publication_0.out index e768a1d41..ff516f9c1 100644 --- a/src/test/regress/expected/publication_0.out +++ b/src/test/regress/expected/publication_0.out @@ -70,7 +70,7 @@ SELECT DISTINCT c FROM ( SELECT worker_create_or_replace_object('CREATE PUBLICATION "pub-all-insertupdateonly" FOR ALL TABLES WITH (publish_via_partition_root = ''false'', publish = ''insert, update'')'); SELECT worker_create_or_replace_object('CREATE PUBLICATION pubempty WITH (publish_via_partition_root = ''false'', publish = ''insert, update, delete, truncate'')'); SELECT worker_create_or_replace_object('CREATE PUBLICATION pubinsertonly WITH (publish_via_partition_root = ''false'', publish = ''insert'')'); -(4 rows) +(N rows) CREATE TABLE test (x int primary key, y int, "column-1" int, doc xml); CREATE TABLE "test-pubs" (x int primary key, y int, "column-1" int); diff --git a/src/test/regress/expected/shard_move_constraints.out b/src/test/regress/expected/shard_move_constraints.out index 72b49f262..59aabe686 100644 --- a/src/test/regress/expected/shard_move_constraints.out +++ b/src/test/regress/expected/shard_move_constraints.out @@ -143,7 +143,7 @@ SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='sensors_8970000' fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) sensors_8970000_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) -(4 rows) +(N rows) SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='sensors_2020_01_01_8970008'::regclass ORDER BY 1,2; Constraint | Definition @@ -155,7 +155,7 @@ SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='sensors_2020_01_ fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) sensors_2020_01_01_8970008_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) -(7 rows) +(N rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename ='sensors_8970000' ORDER BY 1,2; tablename | indexdef @@ -164,7 +164,7 @@ SELECT tablename, indexdef FROM pg_indexes WHERE tablename ='sensors_8970000' OR sensors_8970000 | CREATE INDEX index_on_parent_8970000 ON ONLY "shard Move Fkeys Indexes".sensors_8970000 USING btree (lower((measureid)::text)) sensors_8970000 | CREATE INDEX index_with_include_8970000 ON ONLY "shard Move Fkeys Indexes".sensors_8970000 USING btree (((measure_data -> 'IsFailed'::text))) INCLUDE (measure_data, eventdatetime) sensors_8970000 | CREATE UNIQUE INDEX sensors_pkey_8970000 ON ONLY "shard Move Fkeys Indexes".sensors_8970000 USING btree (measureid, eventdatetime, measure_data) -(4 rows) +(N rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename ='sensors_2020_01_01_8970008' ORDER BY 1,2; tablename | indexdef @@ -174,7 +174,7 @@ SELECT tablename, indexdef FROM pg_indexes WHERE tablename ='sensors_2020_01_01_ sensors_2020_01_01_8970008 | CREATE INDEX sensors_2020_01_01_expr_measure_data_eventdatetime_idx_8970008 ON "shard Move Fkeys Indexes".sensors_2020_01_01_8970008 USING btree (((measure_data -> 'IsFailed'::text))) INCLUDE (measure_data, eventdatetime) sensors_2020_01_01_8970008 | CREATE INDEX sensors_2020_01_01_lower_idx_8970008 ON "shard Move Fkeys Indexes".sensors_2020_01_01_8970008 USING btree (lower((measureid)::text)) sensors_2020_01_01_8970008 | CREATE UNIQUE INDEX sensors_2020_01_01_pkey_8970008 ON "shard Move Fkeys Indexes".sensors_2020_01_01_8970008 USING btree (measureid, eventdatetime, measure_data) -(5 rows) +(N rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename ='index_backed_rep_identity_8970029' ORDER BY 1,2; tablename | indexdef @@ -203,7 +203,7 @@ ORDER BY stxname ASC; s2 s2_8970008 s2_8970010 -(6 rows) +(N rows) SELECT count(*) FROM pg_index WHERE indisclustered @@ -238,7 +238,7 @@ SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='sensors_8970000' fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) sensors_8970000_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) -(4 rows) +(N rows) SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='sensors_2020_01_01_8970008'::regclass ORDER BY 1,2; Constraint | Definition @@ -250,7 +250,7 @@ SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='sensors_2020_01_ fkey_from_parent_to_dist_8970000 | FOREIGN KEY (measureid) REFERENCES colocated_dist_table_8970016(measureid) fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) sensors_2020_01_01_8970008_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) -(7 rows) +(N rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename ='sensors_8970000' ORDER BY 1,2; tablename | indexdef @@ -259,7 +259,7 @@ SELECT tablename, indexdef FROM pg_indexes WHERE tablename ='sensors_8970000' OR sensors_8970000 | CREATE INDEX index_on_parent_8970000 ON ONLY "shard Move Fkeys Indexes".sensors_8970000 USING btree (lower((measureid)::text)) sensors_8970000 | CREATE INDEX index_with_include_8970000 ON ONLY "shard Move Fkeys Indexes".sensors_8970000 USING btree (((measure_data -> 'IsFailed'::text))) INCLUDE (measure_data, eventdatetime) sensors_8970000 | CREATE UNIQUE INDEX sensors_pkey_8970000 ON ONLY "shard Move Fkeys Indexes".sensors_8970000 USING btree (measureid, eventdatetime, measure_data) -(4 rows) +(N rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename ='sensors_2020_01_01_8970008' ORDER BY 1,2; tablename | indexdef @@ -269,7 +269,7 @@ SELECT tablename, indexdef FROM pg_indexes WHERE tablename ='sensors_2020_01_01_ sensors_2020_01_01_8970008 | CREATE INDEX sensors_2020_01_01_expr_measure_data_eventdatetime_idx_8970008 ON "shard Move Fkeys Indexes".sensors_2020_01_01_8970008 USING btree (((measure_data -> 'IsFailed'::text))) INCLUDE (measure_data, eventdatetime) sensors_2020_01_01_8970008 | CREATE INDEX sensors_2020_01_01_lower_idx_8970008 ON "shard Move Fkeys Indexes".sensors_2020_01_01_8970008 USING btree (lower((measureid)::text)) sensors_2020_01_01_8970008 | CREATE UNIQUE INDEX sensors_2020_01_01_pkey_8970008 ON "shard Move Fkeys Indexes".sensors_2020_01_01_8970008 USING btree (measureid, eventdatetime, measure_data) -(5 rows) +(N rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename ='index_backed_rep_identity_8970029' ORDER BY 1,2; tablename | indexdef @@ -300,7 +300,7 @@ ORDER BY stxname ASC; s2_8970008 s2_8970009 s2_8970011 -(8 rows) +(N rows) SELECT count(*) FROM pg_index WHERE indisclustered diff --git a/src/test/regress/expected/shard_move_constraints_blocking.out b/src/test/regress/expected/shard_move_constraints_blocking.out index 5f1b91cb6..7b58378fa 100644 --- a/src/test/regress/expected/shard_move_constraints_blocking.out +++ b/src/test/regress/expected/shard_move_constraints_blocking.out @@ -140,7 +140,7 @@ SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='sensors_8970000' fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) fkey_from_parent_to_ref_8970000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970028(measureid) sensors_8970000_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) -(5 rows) +(N rows) SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='sensors_2020_01_01_8970008'::regclass ORDER BY 1,2; Constraint | Definition @@ -154,7 +154,7 @@ SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='sensors_2020_01_ fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) fkey_from_parent_to_ref_8970000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970028(measureid) sensors_2020_01_01_8970008_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) -(9 rows) +(N rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename ='sensors_8970000' ORDER BY 1,2; tablename | indexdef @@ -163,7 +163,7 @@ SELECT tablename, indexdef FROM pg_indexes WHERE tablename ='sensors_8970000' OR sensors_8970000 | CREATE INDEX index_on_parent_8970000 ON ONLY "blocking shard Move Fkeys Indexes".sensors_8970000 USING btree (lower((measureid)::text)) sensors_8970000 | CREATE INDEX index_with_include_8970000 ON ONLY "blocking shard Move Fkeys Indexes".sensors_8970000 USING btree (((measure_data -> 'IsFailed'::text))) INCLUDE (measure_data, eventdatetime) sensors_8970000 | CREATE UNIQUE INDEX sensors_pkey_8970000 ON ONLY "blocking shard Move Fkeys Indexes".sensors_8970000 USING btree (measureid, eventdatetime, measure_data) -(4 rows) +(N rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename ='sensors_2020_01_01_8970008' ORDER BY 1,2; tablename | indexdef @@ -173,7 +173,7 @@ SELECT tablename, indexdef FROM pg_indexes WHERE tablename ='sensors_2020_01_01_ sensors_2020_01_01_8970008 | CREATE INDEX sensors_2020_01_01_expr_measure_data_eventdatetime_idx_8970008 ON "blocking shard Move Fkeys Indexes".sensors_2020_01_01_8970008 USING btree (((measure_data -> 'IsFailed'::text))) INCLUDE (measure_data, eventdatetime) sensors_2020_01_01_8970008 | CREATE INDEX sensors_2020_01_01_lower_idx_8970008 ON "blocking shard Move Fkeys Indexes".sensors_2020_01_01_8970008 USING btree (lower((measureid)::text)) sensors_2020_01_01_8970008 | CREATE UNIQUE INDEX sensors_2020_01_01_pkey_8970008 ON "blocking shard Move Fkeys Indexes".sensors_2020_01_01_8970008 USING btree (measureid, eventdatetime, measure_data) -(5 rows) +(N rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename ='index_backed_rep_identity_8970029' ORDER BY 1,2; tablename | indexdef @@ -202,7 +202,7 @@ ORDER BY stxname ASC; s2 s2_8970008 s2_8970010 -(6 rows) +(N rows) SELECT count(*) FROM pg_index WHERE indisclustered @@ -238,7 +238,7 @@ SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='sensors_8970000' fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) fkey_from_parent_to_ref_8970000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970028(measureid) sensors_8970000_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) -(5 rows) +(N rows) SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='sensors_2020_01_01_8970008'::regclass ORDER BY 1,2; Constraint | Definition @@ -252,7 +252,7 @@ SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='sensors_2020_01_ fkey_from_parent_to_parent_8970000 | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_8970020(eventdatetime, measureid) fkey_from_parent_to_ref_8970000 | FOREIGN KEY (measureid) REFERENCES reference_table_8970028(measureid) sensors_2020_01_01_8970008_measureid_eventdatetime_fkey | FOREIGN KEY (eventdatetime, measureid) REFERENCES colocated_partitioned_table_2020_01_01_8970024(eventdatetime, measureid) -(9 rows) +(N rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename ='sensors_8970000' ORDER BY 1,2; tablename | indexdef @@ -261,7 +261,7 @@ SELECT tablename, indexdef FROM pg_indexes WHERE tablename ='sensors_8970000' OR sensors_8970000 | CREATE INDEX index_on_parent_8970000 ON ONLY "blocking shard Move Fkeys Indexes".sensors_8970000 USING btree (lower((measureid)::text)) sensors_8970000 | CREATE INDEX index_with_include_8970000 ON ONLY "blocking shard Move Fkeys Indexes".sensors_8970000 USING btree (((measure_data -> 'IsFailed'::text))) INCLUDE (measure_data, eventdatetime) sensors_8970000 | CREATE UNIQUE INDEX sensors_pkey_8970000 ON ONLY "blocking shard Move Fkeys Indexes".sensors_8970000 USING btree (measureid, eventdatetime, measure_data) -(4 rows) +(N rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename ='sensors_2020_01_01_8970008' ORDER BY 1,2; tablename | indexdef @@ -271,7 +271,7 @@ SELECT tablename, indexdef FROM pg_indexes WHERE tablename ='sensors_2020_01_01_ sensors_2020_01_01_8970008 | CREATE INDEX sensors_2020_01_01_expr_measure_data_eventdatetime_idx_8970008 ON "blocking shard Move Fkeys Indexes".sensors_2020_01_01_8970008 USING btree (((measure_data -> 'IsFailed'::text))) INCLUDE (measure_data, eventdatetime) sensors_2020_01_01_8970008 | CREATE INDEX sensors_2020_01_01_lower_idx_8970008 ON "blocking shard Move Fkeys Indexes".sensors_2020_01_01_8970008 USING btree (lower((measureid)::text)) sensors_2020_01_01_8970008 | CREATE UNIQUE INDEX sensors_2020_01_01_pkey_8970008 ON "blocking shard Move Fkeys Indexes".sensors_2020_01_01_8970008 USING btree (measureid, eventdatetime, measure_data) -(5 rows) +(N rows) SELECT tablename, indexdef FROM pg_indexes WHERE tablename ='index_backed_rep_identity_8970029' ORDER BY 1,2; tablename | indexdef @@ -302,7 +302,7 @@ ORDER BY stxname ASC; s2_8970008 s2_8970009 s2_8970011 -(8 rows) +(N rows) SELECT count(*) FROM pg_index WHERE indisclustered diff --git a/src/test/regress/expected/stat_statements.out b/src/test/regress/expected/stat_statements.out index 7ad87ff5f..8b6e06e17 100644 --- a/src/test/regress/expected/stat_statements.out +++ b/src/test/regress/expected/stat_statements.out @@ -23,7 +23,7 @@ NOTICE: extension "pg_stat_statements" does not exist, skipping SELECT extname FROM pg_extension WHERE extname = 'pg_stat_statements'; extname --------------------------------------------------------------------- -(0 rows) +(N rows) -- this should error out since extension is not created yet SELECT * FROM citus_stat_statements; @@ -90,7 +90,7 @@ SELECT citus_stat_statements_reset(); SELECT normalize_query_string(query) FROM citus_stat_statements; normalize_query_string --------------------------------------------------------------------- -(0 rows) +(N rows) -- run some queries SELECT count(*) FROM lineitem_hash_part; @@ -108,12 +108,12 @@ SELECT count(*) FROM lineitem_hash_part; SELECT l_orderkey FROM lineitem_hash_part; l_orderkey --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT l_orderkey FROM lineitem_hash_part WHERE l_orderkey > 100; l_orderkey --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT count(*) FROM lineitem_hash_part WHERE l_orderkey = 4; count @@ -150,7 +150,7 @@ ORDER BY 1, 2, 3, 4; SELECT count(*) FROM lineitem_hash_part WHERE l_orderkey = ? | adaptive | 4 | 2 SELECT l_orderkey FROM lineitem_hash_part | adaptive | | 1 SELECT l_orderkey FROM lineitem_hash_part WHERE l_orderkey > ? | adaptive | | 1 -(6 rows) +(N rows) -- test GUC citus.stat_statements_track SET citus.stat_statements_track TO 'none'; @@ -173,7 +173,7 @@ ORDER BY 1, 2, 3, 4; SELECT count(*) FROM lineitem_hash_part WHERE l_orderkey = ? | adaptive | 4 | 2 SELECT l_orderkey FROM lineitem_hash_part | adaptive | | 1 SELECT l_orderkey FROM lineitem_hash_part WHERE l_orderkey > ? | adaptive | | 1 -(6 rows) +(N rows) -- reset the GUC to track stats SET citus.stat_statements_track TO 'all'; @@ -188,7 +188,7 @@ SELECT pg_stat_statements_reset() IS NOT NULL AS t; SELECT * FROM citus_stat_statements; queryid | userid | dbid | query | executor | partition_key | calls --------------------------------------------------------------------- -(0 rows) +(N rows) -- run some queries SELECT count(*) FROM lineitem_hash_part; @@ -206,12 +206,12 @@ SELECT count(*) FROM lineitem_hash_part; SELECT l_orderkey FROM lineitem_hash_part; l_orderkey --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT l_orderkey FROM lineitem_hash_part WHERE l_orderkey > 100; l_orderkey --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT count(*) FROM lineitem_hash_part WHERE l_orderkey = 4; count @@ -249,7 +249,7 @@ ORDER BY 1, 2, 3, 4; SELECT count(*) FROM lineitem_hash_part WHERE l_orderkey = ? | adaptive | 4 | 2 SELECT l_orderkey FROM lineitem_hash_part | adaptive | | 1 SELECT l_orderkey FROM lineitem_hash_part WHERE l_orderkey > ? | adaptive | | 1 -(6 rows) +(N rows) SELECT pg_stat_statements_reset() IS NOT NULL AS t; t @@ -281,7 +281,7 @@ ORDER BY 1, 2, 3, 4; SELECT count(*) FROM lineitem_hash_part WHERE l_orderkey = ? | adaptive | 1 | 1 SELECT count(*) FROM lineitem_hash_part WHERE l_orderkey = ? | adaptive | 1200 | 1 SELECT count(*) FROM lineitem_hash_part WHERE l_orderkey = ? | adaptive | 4 | 3 -(4 rows) +(N rows) -- citus_stat_statements_reset() must be called to reset call counts SELECT citus_stat_statements_reset(); @@ -310,7 +310,7 @@ ORDER BY 1, 2, 3, 4; --------------------------------------------------------------------- SELECT count(*) FROM lineitem_hash_part | adaptive | | 1 SELECT count(*) FROM lineitem_hash_part WHERE l_orderkey = ? | adaptive | 4 | 1 -(2 rows) +(N rows) -- create test tables to run update/delete scenarios CREATE TABLE stat_test_text(user_id text, value int); @@ -325,19 +325,19 @@ SELECT citus_stat_statements_reset(); SELECT * FROM stat_test_text; user_id | value --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT * FROM stat_test_bigint WHERE user_id = 1::bigint; user_id | value --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT normalize_query_string(query), executor, partition_key, calls FROM citus_stat_statements ORDER BY 1, 2, 3, 4; normalize_query_string | executor | partition_key | calls --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT create_distributed_table('stat_test_text', 'user_id'); create_distributed_table @@ -356,27 +356,27 @@ FROM citus_stat_statements ORDER BY 1, 2, 3, 4; normalize_query_string | executor | partition_key | calls --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT * FROM stat_test_text; user_id | value --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT * FROM stat_test_text WHERE user_id = 'me'; user_id | value --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT * FROM stat_test_bigint; user_id | value --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT * FROM stat_test_bigint WHERE user_id = 2::bigint; user_id | value --------------------------------------------------------------------- -(0 rows) +(N rows) SELECT normalize_query_string(query), executor, partition_key, calls FROM citus_stat_statements @@ -387,7 +387,7 @@ ORDER BY 1, 2, 3, 4; SELECT * FROM stat_test_bigint WHERE user_id = ?::bigint | adaptive | 2 | 1 SELECT * FROM stat_test_text | adaptive | | 1 SELECT * FROM stat_test_text WHERE user_id = ? | adaptive | me | 1 -(4 rows) +(N rows) -- insert some rows and check stats INSERT INTO stat_test_bigint VALUES (1, 1); @@ -407,7 +407,7 @@ ORDER BY 1, 2, 3, 4; SELECT * FROM stat_test_bigint WHERE user_id = ?::bigint | adaptive | 2 | 1 SELECT * FROM stat_test_text | adaptive | | 1 SELECT * FROM stat_test_text WHERE user_id = ? | adaptive | me | 1 -(8 rows) +(N rows) -- delete some rows and check stats SELECT citus_stat_statements_reset(); @@ -429,7 +429,7 @@ ORDER BY 1, 2, 3, 4; DELETE FROM stat_test_bigint WHERE user_id = ? | adaptive | 1000 | 2 DELETE FROM stat_test_bigint WHERE user_id > ? | adaptive | | 1 DELETE FROM stat_test_bigint WHERE value > ? | adaptive | | 2 -(3 rows) +(N rows) -- update some rows and check stats SELECT citus_stat_statements_reset(); @@ -451,7 +451,7 @@ ORDER BY 1, 2, 3, 4; UPDATE stat_test_bigint SET value = ? WHERE user_id = ? | adaptive | 3 | 2 UPDATE stat_test_bigint SET value = ? WHERE user_id > ? | adaptive | | 1 UPDATE stat_test_bigint SET value = ? WHERE value = ? | adaptive | | 2 -(3 rows) +(N rows) -- test joins CREATE TABLE stat_test_bigint_other(LIKE stat_test_bigint); @@ -514,7 +514,7 @@ ORDER BY 1, 2, 3, 4; WHERE b.user_id = ? | | | SELECT count(*) FROM stat_test_bigint b JOIN stat_test_bigint_other o USING (user_id)+| adaptive | 3 | 1 WHERE o.user_id = ? | | | -(5 rows) +(N rows) -- test reference table CREATE TABLE stat_test_reference(LIKE stat_test_bigint); @@ -596,7 +596,7 @@ ORDER BY 1, 2, 3, 4; WHERE r.user_id = ? | | | SELECT count(*) FROM stat_test_reference | adaptive | | 1 SELECT count(*) FROM stat_test_reference WHERE user_id = ? | adaptive | | 2 -(6 rows) +(N rows) -- non-stats role should only see its own entries, even when calling citus_query_stats directly CREATE USER nostats;