diff --git a/src/test/regress/expected/single_node.out b/src/test/regress/expected/single_node.out index 6177e215e..0490d1848 100644 --- a/src/test/regress/expected/single_node.out +++ b/src/test/regress/expected/single_node.out @@ -503,6 +503,82 @@ INSERT INTO upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLICT ON CONST (0 rows) DROP TABLE upsert_test; +CREATE TABLE relation_tracking_table_1(id int, nonid int); +SELECT create_distributed_table('relation_tracking_table_1', 'id', colocate_with := 'none'); + create_distributed_table +--------------------------------------------------------------------- + +(1 row) + +INSERT INTO relation_tracking_table_1 select generate_series(6, 10000, 1), 0; +CREATE or REPLACE function foo() +returns setof relation_tracking_table_1 +AS $$ +BEGIN +RETURN query select * from relation_tracking_table_1 order by 1 limit 10; +end; +$$ language plpgsql; +CREATE TABLE relation_tracking_table_2 (id int, nonid int); +-- use the relation-access in this session +select foo(); + foo +--------------------------------------------------------------------- + (6,0) + (7,0) + (8,0) + (9,0) + (10,0) + (11,0) + (12,0) + (13,0) + (14,0) + (15,0) +(10 rows) + +-- we should be able to use sequential mode, as the previous multi-shard +-- relation access has been cleaned-up +BEGIN; +SET LOCAL citus.multi_shard_modify_mode TO sequential; +INSERT INTO relation_tracking_table_2 select generate_series(6, 1000, 1), 0; +SELECT create_distributed_table('relation_tracking_table_2', 'id', colocate_with := 'none'); +NOTICE: Copying data from local table... +NOTICE: copying the data has completed +DETAIL: The local data in the table is no longer visible, but is still on disk. +HINT: To remove the local data, run: SELECT truncate_local_data_after_distributing_table($$single_node.relation_tracking_table_2$$) + create_distributed_table +--------------------------------------------------------------------- + +(1 row) + +SELECT count(*) FROM relation_tracking_table_2; + count +--------------------------------------------------------------------- + 995 +(1 row) + +ROLLBACK; +BEGIN; +INSERT INTO relation_tracking_table_2 select generate_series(6, 1000, 1), 0; +SELECT create_distributed_table('relation_tracking_table_2', 'id', colocate_with := 'none'); +NOTICE: Copying data from local table... +NOTICE: copying the data has completed +DETAIL: The local data in the table is no longer visible, but is still on disk. +HINT: To remove the local data, run: SELECT truncate_local_data_after_distributing_table($$single_node.relation_tracking_table_2$$) + create_distributed_table +--------------------------------------------------------------------- + +(1 row) + +SELECT count(*) FROM relation_tracking_table_2; + count +--------------------------------------------------------------------- + 995 +(1 row) + +COMMIT; +SET client_min_messages TO ERROR; +DROP TABLE relation_tracking_table_2, relation_tracking_table_1 CASCADE; +RESET client_min_messages; CREATE SCHEMA "Quoed.Schema"; SET search_path TO "Quoed.Schema"; CREATE TABLE "long_constraint_upsert\_test" @@ -541,13 +617,9 @@ NOTICE: identifier "looo oooo ooooo ooooooooooooooooo oooooooo oooooooo ng quot ERROR: renaming constraints belonging to distributed tables is currently unsupported --INSERT INTO simple_table_name (part_key, other_col) VALUES (1, 1) ON CONFLICT ON CONSTRAINT simple_constraint_name DO NOTHING RETURNING *; SET search_path TO single_node; +SET client_min_messages TO ERROR; DROP SCHEMA "Quoed.Schema" CASCADE; -NOTICE: drop cascades to 5 other objects -DETAIL: drop cascades to table "Quoed.Schema".simple_table_name -drop cascades to table "Quoed.Schema".simple_table_name_90630528 -drop cascades to table "Quoed.Schema".simple_table_name_90630529 -drop cascades to table "Quoed.Schema".simple_table_name_90630530 -drop cascades to table "Quoed.Schema".simple_table_name_90630531 +RESET client_min_messages; -- test partitioned index creation with long name CREATE TABLE test_index_creation1 ( diff --git a/src/test/regress/sql/single_node.sql b/src/test/regress/sql/single_node.sql index 21ae9e3ac..09a8c9870 100644 --- a/src/test/regress/sql/single_node.sql +++ b/src/test/regress/sql/single_node.sql @@ -252,6 +252,42 @@ INSERT INTO upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLICT ON CONST DROP TABLE upsert_test; +CREATE TABLE relation_tracking_table_1(id int, nonid int); +SELECT create_distributed_table('relation_tracking_table_1', 'id', colocate_with := 'none'); +INSERT INTO relation_tracking_table_1 select generate_series(6, 10000, 1), 0; + +CREATE or REPLACE function foo() +returns setof relation_tracking_table_1 +AS $$ +BEGIN +RETURN query select * from relation_tracking_table_1 order by 1 limit 10; +end; +$$ language plpgsql; + +CREATE TABLE relation_tracking_table_2 (id int, nonid int); + +-- use the relation-access in this session +select foo(); + +-- we should be able to use sequential mode, as the previous multi-shard +-- relation access has been cleaned-up +BEGIN; +SET LOCAL citus.multi_shard_modify_mode TO sequential; +INSERT INTO relation_tracking_table_2 select generate_series(6, 1000, 1), 0; +SELECT create_distributed_table('relation_tracking_table_2', 'id', colocate_with := 'none'); +SELECT count(*) FROM relation_tracking_table_2; +ROLLBACK; + +BEGIN; +INSERT INTO relation_tracking_table_2 select generate_series(6, 1000, 1), 0; +SELECT create_distributed_table('relation_tracking_table_2', 'id', colocate_with := 'none'); +SELECT count(*) FROM relation_tracking_table_2; +COMMIT; + +SET client_min_messages TO ERROR; +DROP TABLE relation_tracking_table_2, relation_tracking_table_1 CASCADE; +RESET client_min_messages; + CREATE SCHEMA "Quoed.Schema"; SET search_path TO "Quoed.Schema"; @@ -280,7 +316,9 @@ ALTER TABLE simple_table_name RENAME CONSTRAINT "looo oooo ooooo ooooooooooooooo --INSERT INTO simple_table_name (part_key, other_col) VALUES (1, 1) ON CONFLICT ON CONSTRAINT simple_constraint_name DO NOTHING RETURNING *; SET search_path TO single_node; +SET client_min_messages TO ERROR; DROP SCHEMA "Quoed.Schema" CASCADE; +RESET client_min_messages; -- test partitioned index creation with long name CREATE TABLE test_index_creation1