diff --git a/src/test/regress/bin/normalize.sed b/src/test/regress/bin/normalize.sed index 929eb548f..e74229049 100644 --- a/src/test/regress/bin/normalize.sed +++ b/src/test/regress/bin/normalize.sed @@ -12,6 +12,10 @@ s/ port=[0-9]+ / port=xxxxx /g s/placement [0-9]+/placement xxxxx/g s/shard [0-9]+/shard xxxxx/g s/assigned task [0-9]+ to node/assigned task to node/ +s/node group [12] (but|does)/node group \1/ + +# Differing names can have differing table column widths +s/(-+\|)+-+/---/g # In foreign_key_to_reference_table, normalize shard table names, etc in # the generated plan @@ -69,3 +73,16 @@ s/(job_[0-9]+\/task_[0-9]+\/p_[0-9]+\.)[0-9]+/\1xxxx/g # isolation_ref2ref_foreign_keys s/"(ref_table_[0-9]_|ref_table_[0-9]_value_fkey_)[0-9]+"/"\1xxxxxxx"/g + +# Line info varies between versions +/^LINE [0-9]+:.*$/d +/^ *\^$/d + +# pg12 changes +s/Partitioned table "/Table "/g +s/\) TABLESPACE pg_default$/\)/g +s/invalid input syntax for type /invalid input syntax for /g +s/_id_ref_id_fkey/_id_fkey/g +s/_ref_id_id_fkey_/_ref_id_fkey_/g +s/fk_test_2_col1_col2_fkey/fk_test_2_col1_fkey/g +s/_id_other_column_ref_fkey/_id_fkey/g diff --git a/src/test/regress/bin/normalized_tests.lst b/src/test/regress/bin/normalized_tests.lst index 39b6eff34..a893e270a 100644 --- a/src/test/regress/bin/normalized_tests.lst +++ b/src/test/regress/bin/normalized_tests.lst @@ -1,41 +1,44 @@ # List of tests whose output we want to normalize, one per line -multi_alter_table_add_constraints -multi_alter_table_statements -foreign_key_to_reference_table +custom_aggregate_support failure_copy_on_hash -failure_savepoints -foreign_key_restriction_enforcement failure_real_time_select +failure_savepoints failure_vacuum +foreign_key_restriction_enforcement +foreign_key_to_reference_table +intermediate_results isolation_citus_dist_activity isolation_ref2ref_foreign_keys +multi_alter_table_add_constraints +multi_alter_table_statements +multi_copy +multi_create_table_constraints +multi_explain +multi_foreign_key +multi_generate_ddl_commands +multi_having_pushdown multi_insert_select multi_insert_select_conflict -multi_multiuser -multi_name_lengths -multi_partition_pruning -multi_subtransactions -multi_modifying_xacts -multi_insert_select -sql_procedure -multi_reference_table -multi_create_table_constraints - -# the following tests' output are -# normalized for EXPLAIN outputs -# where the executor name is wiped out multi_join_order_tpch_small multi_join_pruning +multi_master_protocol +multi_metadata_sync +multi_modifying_xacts +multi_multiuser +multi_mx_explain +multi_name_lengths +multi_null_minmax_value_pruning multi_orderby_limit_pushdown +multi_partitioning +multi_partitioning_utils multi_partition_pruning +multi_reference_table multi_select_distinct multi_subquery_window_functions +multi_subtransactions multi_task_assignment_policy multi_view -multi_explain -multi_null_minmax_value_pruning +sql_procedure window_functions -multi_having_pushdown -multi_partitioning -multi_mx_explain -custom_aggregate_support +worker_check_invalid_arguments + diff --git a/src/test/regress/expected/failure_multi_dml.out b/src/test/regress/expected/failure_multi_dml.out index 380fab673..734412fa9 100644 --- a/src/test/regress/expected/failure_multi_dml.out +++ b/src/test/regress/expected/failure_multi_dml.out @@ -305,7 +305,7 @@ SELECT citus.mitmproxy('conn.onQuery(query="^COMMIT").kill()'); -- hide the error message (it has the PID)... -- we'll test for the txn side-effects to ensure it didn't run -SET client_min_messages TO FATAL; +SET client_min_messages TO ERROR; BEGIN; DELETE FROM dml_test WHERE id = 1; DELETE FROM dml_test WHERE id = 2; diff --git a/src/test/regress/expected/failure_multi_dml_9.out b/src/test/regress/expected/failure_multi_dml_9.out index 6d8e928eb..0552e8e80 100644 --- a/src/test/regress/expected/failure_multi_dml_9.out +++ b/src/test/regress/expected/failure_multi_dml_9.out @@ -305,7 +305,7 @@ SELECT citus.mitmproxy('conn.onQuery(query="^COMMIT").kill()'); -- hide the error message (it has the PID)... -- we'll test for the txn side-effects to ensure it didn't run -SET client_min_messages TO FATAL; +SET client_min_messages TO ERROR; BEGIN; DELETE FROM dml_test WHERE id = 1; DELETE FROM dml_test WHERE id = 2; diff --git a/src/test/regress/expected/foreign_key_restriction_enforcement.out b/src/test/regress/expected/foreign_key_restriction_enforcement.out index ee0b3d889..b527f5f16 100644 --- a/src/test/regress/expected/foreign_key_restriction_enforcement.out +++ b/src/test/regress/expected/foreign_key_restriction_enforcement.out @@ -532,7 +532,7 @@ BEGIN; DEBUG: switching to sequential query execution mode DETAIL: Reference relation "transitive_reference_table" is modified, which might lead to data inconsistencies or distributed deadlocks via parallel accesses to hash distributed relations due to foreign keys. Any parallel modification to those hash distributed relations in the same transaction can only be executed in sequential query execution mode COPY on_update_fkey_table FROM STDIN WITH CSV; -ERROR: insert or update on table "on_update_fkey_table_2380005" violates foreign key constraint "fkey_2380005" +ERROR: insert or update on table "on_update_fkey_table_2380004" violates foreign key constraint "fkey_2380004" DETAIL: Key (value_1)=(101) is not present in table "reference_table_2380001". ROLLBACK; -- case 2.8: UPDATE to a reference table is followed by TRUNCATE @@ -817,6 +817,8 @@ ERROR: cannot execute DDL on reference relation "transitive_reference_table" be HINT: Try re-running the transaction with "SET LOCAL citus.multi_shard_modify_mode TO 'sequential';" ROLLBACK; -- case 4.5: SELECT to a dist table is follwed by a TRUNCATE +\set VERBOSITY terse +SET client_min_messages to LOG; BEGIN; SELECT count(*) FROM on_update_fkey_table WHERE value_1 = 99; count @@ -825,11 +827,8 @@ BEGIN; (1 row) TRUNCATE reference_table CASCADE; -DEBUG: switching to sequential query execution mode -DETAIL: Reference relation "reference_table" is modified, which might lead to data inconsistencies or distributed deadlocks via parallel accesses to hash distributed relations due to foreign keys. Any parallel modification to those hash distributed relations in the same transaction can only be executed in sequential query execution mode NOTICE: truncate cascades to table "on_update_fkey_table" ERROR: cannot execute DDL on reference relation "reference_table" because there was a parallel SELECT access to distributed relation "on_update_fkey_table" in the same transaction -HINT: Try re-running the transaction with "SET LOCAL citus.multi_shard_modify_mode TO 'sequential';" ROLLBACK; BEGIN; SELECT count(*) FROM on_update_fkey_table WHERE value_1 = 99; @@ -839,12 +838,9 @@ BEGIN; (1 row) TRUNCATE transitive_reference_table CASCADE; -DEBUG: switching to sequential query execution mode -DETAIL: Reference relation "transitive_reference_table" is modified, which might lead to data inconsistencies or distributed deadlocks via parallel accesses to hash distributed relations due to foreign keys. Any parallel modification to those hash distributed relations in the same transaction can only be executed in sequential query execution mode NOTICE: truncate cascades to table "reference_table" NOTICE: truncate cascades to table "on_update_fkey_table" ERROR: cannot execute DDL on reference relation "transitive_reference_table" because there was a parallel SELECT access to distributed relation "on_update_fkey_table" in the same transaction -HINT: Try re-running the transaction with "SET LOCAL citus.multi_shard_modify_mode TO 'sequential';" ROLLBACK; -- case 4.6: Router SELECT to a dist table is followed by a TRUNCATE BEGIN; @@ -855,19 +851,7 @@ BEGIN; (1 row) TRUNCATE reference_table CASCADE; -DEBUG: switching to sequential query execution mode -DETAIL: Reference relation "reference_table" is modified, which might lead to data inconsistencies or distributed deadlocks via parallel accesses to hash distributed relations due to foreign keys. Any parallel modification to those hash distributed relations in the same transaction can only be executed in sequential query execution mode NOTICE: truncate cascades to table "on_update_fkey_table" -DEBUG: truncate cascades to table "on_update_fkey_table_2380003" -DETAIL: NOTICE from localhost:57638 -DEBUG: truncate cascades to table "on_update_fkey_table_2380005" -DETAIL: NOTICE from localhost:57638 -DEBUG: truncate cascades to table "on_update_fkey_table_2380002" -DETAIL: NOTICE from localhost:57637 -DEBUG: truncate cascades to table "on_update_fkey_table_2380004" -DETAIL: NOTICE from localhost:57637 -DEBUG: building index "reference_table_pkey" on table "reference_table" serially -DEBUG: building index "on_update_fkey_table_pkey" on table "on_update_fkey_table" serially ROLLBACK; BEGIN; SELECT count(*) FROM on_update_fkey_table WHERE id = 9; @@ -877,34 +861,11 @@ BEGIN; (1 row) TRUNCATE transitive_reference_table CASCADE; -DEBUG: switching to sequential query execution mode -DETAIL: Reference relation "transitive_reference_table" is modified, which might lead to data inconsistencies or distributed deadlocks via parallel accesses to hash distributed relations due to foreign keys. Any parallel modification to those hash distributed relations in the same transaction can only be executed in sequential query execution mode NOTICE: truncate cascades to table "reference_table" NOTICE: truncate cascades to table "on_update_fkey_table" -DEBUG: truncate cascades to table "reference_table_2380001" -DETAIL: NOTICE from localhost:57638 -DEBUG: truncate cascades to table "on_update_fkey_table_2380003" -DETAIL: NOTICE from localhost:57638 -DEBUG: truncate cascades to table "on_update_fkey_table_2380005" -DETAIL: NOTICE from localhost:57638 -DEBUG: truncate cascades to table "reference_table_2380001" -DETAIL: NOTICE from localhost:57637 -DEBUG: truncate cascades to table "on_update_fkey_table_2380002" -DETAIL: NOTICE from localhost:57637 -DEBUG: truncate cascades to table "on_update_fkey_table_2380004" -DETAIL: NOTICE from localhost:57637 -DEBUG: truncate cascades to table "on_update_fkey_table_2380002" -DETAIL: NOTICE from localhost:57637 -DEBUG: truncate cascades to table "on_update_fkey_table_2380003" -DETAIL: NOTICE from localhost:57638 -DEBUG: truncate cascades to table "on_update_fkey_table_2380004" -DETAIL: NOTICE from localhost:57637 -DEBUG: truncate cascades to table "on_update_fkey_table_2380005" -DETAIL: NOTICE from localhost:57638 -DEBUG: building index "transitive_reference_table_pkey" on table "transitive_reference_table" serially -DEBUG: building index "reference_table_pkey" on table "reference_table" serially -DEBUG: building index "on_update_fkey_table_pkey" on table "on_update_fkey_table" serially ROLLBACK; +RESET client_min_messages; +\set VERBOSITY default -- case 5.1: Parallel UPDATE on distributed table follow by a SELECT BEGIN; UPDATE on_update_fkey_table SET value_1 = 16 WHERE value_1 = 15; @@ -954,18 +915,12 @@ ROLLBACK; BEGIN; UPDATE on_update_fkey_table SET value_1 = 16 WHERE value_1 = 15; ALTER TABLE reference_table ALTER COLUMN id SET DATA TYPE smallint; -DEBUG: rewriting table "reference_table" -DEBUG: building index "reference_table_pkey" on table "reference_table" serially -DEBUG: validating foreign key constraint "fkey" ERROR: cannot execute DDL on reference relation "reference_table" because there was a parallel DML access to distributed relation "on_update_fkey_table" in the same transaction HINT: Try re-running the transaction with "SET LOCAL citus.multi_shard_modify_mode TO 'sequential';" ROLLBACK; BEGIN; UPDATE on_update_fkey_table SET value_1 = 16 WHERE value_1 = 15; ALTER TABLE transitive_reference_table ALTER COLUMN id SET DATA TYPE smallint; -DEBUG: rewriting table "transitive_reference_table" -DEBUG: building index "transitive_reference_table_pkey" on table "transitive_reference_table" serially -DEBUG: validating foreign key constraint "fkey" ERROR: cannot execute DDL on reference relation "transitive_reference_table" because there was a parallel DML access to distributed relation "on_update_fkey_table" in the same transaction HINT: Try re-running the transaction with "SET LOCAL citus.multi_shard_modify_mode TO 'sequential';" ROLLBACK; @@ -985,16 +940,10 @@ ROLLBACK; -- case 6:2: Related parallel DDL on distributed table followed by SELECT on ref. table BEGIN; ALTER TABLE on_update_fkey_table ALTER COLUMN value_1 SET DATA TYPE smallint; -DEBUG: rewriting table "on_update_fkey_table" -DEBUG: building index "on_update_fkey_table_pkey" on table "on_update_fkey_table" serially -DEBUG: validating foreign key constraint "fkey" UPDATE reference_table SET id = 160 WHERE id = 15; ROLLBACK; BEGIN; ALTER TABLE on_update_fkey_table ALTER COLUMN value_1 SET DATA TYPE smallint; -DEBUG: rewriting table "on_update_fkey_table" -DEBUG: building index "on_update_fkey_table_pkey" on table "on_update_fkey_table" serially -DEBUG: validating foreign key constraint "fkey" UPDATE transitive_reference_table SET id = 160 WHERE id = 15; ROLLBACK; -- case 6:3: Unrelated parallel DDL on distributed table followed by UPDATE on ref. table @@ -1090,26 +1039,14 @@ ERROR: current transaction is aborted, commands ignored until end of transactio ROLLBACK; BEGIN; CREATE TABLE test_table_1(id int PRIMARY KEY); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_1_pkey" for table "test_table_1" -DEBUG: building index "test_table_1_pkey" on table "test_table_1" serially SELECT create_reference_table('test_table_1'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_reference_table ------------------------ (1 row) CREATE TABLE test_table_2(id int PRIMARY KEY, value_1 int, FOREIGN KEY(value_1) REFERENCES test_table_1(id)); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_2_pkey" for table "test_table_2" -DEBUG: building index "test_table_2_pkey" on table "test_table_2" serially SELECT create_distributed_table('test_table_2', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_distributed_table -------------------------- @@ -1123,39 +1060,21 @@ ROLLBACK; -- already executed a parallel query BEGIN; CREATE TABLE test_table_1(id int PRIMARY KEY); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_1_pkey" for table "test_table_1" -DEBUG: building index "test_table_1_pkey" on table "test_table_1" serially SELECT create_reference_table('test_table_1'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_reference_table ------------------------ (1 row) CREATE TABLE tt4(id int PRIMARY KEY, value_1 int, FOREIGN KEY(id) REFERENCES tt4(id)); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "tt4_pkey" for table "tt4" -DEBUG: building index "tt4_pkey" on table "tt4" serially SELECT create_distributed_table('tt4', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_distributed_table -------------------------- (1 row) CREATE TABLE test_table_2(id int PRIMARY KEY, value_1 int, FOREIGN KEY(value_1) REFERENCES test_table_1(id), FOREIGN KEY(id) REFERENCES tt4(id)); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_2_pkey" for table "test_table_2" -DEBUG: building index "test_table_2_pkey" on table "test_table_2" serially SELECT create_distributed_table('test_table_2', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 ERROR: cannot distribute relation "test_table_2" in this transaction because it has a foreign key to a reference table DETAIL: If a hash distributed table has a foreign key to a reference table, it has to be created in sequential mode before any parallel commands have been executed in the same transaction HINT: Try re-running the transaction with "SET LOCAL citus.multi_shard_modify_mode TO 'sequential';" @@ -1170,39 +1089,21 @@ ROLLBACK; BEGIN; SET LOCAL citus.multi_shard_modify_mode TO 'sequential'; CREATE TABLE test_table_1(id int PRIMARY KEY); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_1_pkey" for table "test_table_1" -DEBUG: building index "test_table_1_pkey" on table "test_table_1" serially SELECT create_reference_table('test_table_1'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_reference_table ------------------------ (1 row) CREATE TABLE tt4(id int PRIMARY KEY, value_1 int, FOREIGN KEY(id) REFERENCES tt4(id)); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "tt4_pkey" for table "tt4" -DEBUG: building index "tt4_pkey" on table "tt4" serially SELECT create_distributed_table('tt4', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_distributed_table -------------------------- (1 row) CREATE TABLE test_table_2(id int PRIMARY KEY, value_1 int, FOREIGN KEY(value_1) REFERENCES test_table_1(id), FOREIGN KEY(id) REFERENCES tt4(id)); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_2_pkey" for table "test_table_2" -DEBUG: building index "test_table_2_pkey" on table "test_table_2" serially SELECT create_distributed_table('test_table_2', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_distributed_table -------------------------- @@ -1218,26 +1119,14 @@ ROLLBACK; BEGIN; CREATE TABLE test_table_1(id int PRIMARY KEY); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_1_pkey" for table "test_table_1" -DEBUG: building index "test_table_1_pkey" on table "test_table_1" serially SELECT create_reference_table('test_table_1'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_reference_table ------------------------ (1 row) CREATE TABLE test_table_2(id int PRIMARY KEY, value_1 int); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_2_pkey" for table "test_table_2" -DEBUG: building index "test_table_2_pkey" on table "test_table_2" serially SELECT create_distributed_table('test_table_2', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_distributed_table -------------------------- @@ -1258,26 +1147,14 @@ BEGIN; SET LOCAL citus.multi_shard_modify_mode TO 'sequential'; CREATE TABLE test_table_1(id int PRIMARY KEY); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_1_pkey" for table "test_table_1" -DEBUG: building index "test_table_1_pkey" on table "test_table_1" serially SELECT create_reference_table('test_table_1'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_reference_table ------------------------ (1 row) CREATE TABLE test_table_2(id int PRIMARY KEY, value_1 int); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_2_pkey" for table "test_table_2" -DEBUG: building index "test_table_2_pkey" on table "test_table_2" serially SELECT create_distributed_table('test_table_2', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_distributed_table -------------------------- @@ -1293,26 +1170,14 @@ COMMIT; -- changed BEGIN; CREATE TABLE test_table_2(id int PRIMARY KEY, value_1 int); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_2_pkey" for table "test_table_2" -DEBUG: building index "test_table_2_pkey" on table "test_table_2" serially SELECT create_distributed_table('test_table_2', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_distributed_table -------------------------- (1 row) CREATE TABLE test_table_1(id int PRIMARY KEY); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_1_pkey" for table "test_table_1" -DEBUG: building index "test_table_1_pkey" on table "test_table_1" serially SELECT create_reference_table('test_table_1'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_reference_table ------------------------ @@ -1332,26 +1197,14 @@ ROLLBACK; BEGIN; SET LOCAL citus.multi_shard_modify_mode TO 'sequential'; CREATE TABLE test_table_2(id int PRIMARY KEY, value_1 int); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_2_pkey" for table "test_table_2" -DEBUG: building index "test_table_2_pkey" on table "test_table_2" serially SELECT create_distributed_table('test_table_2', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_distributed_table -------------------------- (1 row) CREATE TABLE test_table_1(id int PRIMARY KEY); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_1_pkey" for table "test_table_1" -DEBUG: building index "test_table_1_pkey" on table "test_table_1" serially SELECT create_reference_table('test_table_1'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_reference_table ------------------------ @@ -1374,13 +1227,7 @@ BEGIN; SET LOCAL citus.multi_shard_modify_mode TO 'sequential'; CREATE TABLE test_table_2(id int PRIMARY KEY, value_1 int); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_2_pkey" for table "test_table_2" -DEBUG: building index "test_table_2_pkey" on table "test_table_2" serially SELECT create_distributed_table('test_table_2', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 ERROR: cannot distribute relation "test_table_2" in this transaction because it has a foreign key to a reference table DETAIL: If a hash distributed table has a foreign key to a reference table, it has to be created in sequential mode before any parallel commands have been executed in the same transaction HINT: Try re-running the transaction with "SET LOCAL citus.multi_shard_modify_mode TO 'sequential';" @@ -1401,32 +1248,17 @@ ROLLBACK; BEGIN; CREATE TABLE test_table_1(id int PRIMARY KEY); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_1_pkey" for table "test_table_1" -DEBUG: building index "test_table_1_pkey" on table "test_table_1" serially INSERT INTO test_table_1 SELECT i FROM generate_series(0,100) i; CREATE TABLE test_table_2(id int PRIMARY KEY, value_1 int, FOREIGN KEY(value_1) REFERENCES test_table_1(id)); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_2_pkey" for table "test_table_2" -DEBUG: building index "test_table_2_pkey" on table "test_table_2" serially INSERT INTO test_table_2 SELECT i, i FROM generate_series(0,100) i; SELECT create_reference_table('test_table_1'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 -DEBUG: switching to sequential query execution mode -DETAIL: Reference relation "test_table_1" is modified, which might lead to data inconsistencies or distributed deadlocks via parallel accesses to hash distributed relations due to foreign keys. Any parallel modification to those hash distributed relations in the same transaction can only be executed in sequential query execution mode NOTICE: Copying data from local table... -DEBUG: Copied 101 rows create_reference_table ------------------------ (1 row) SELECT create_distributed_table('test_table_2', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 ERROR: cannot distribute "test_table_2" in sequential mode because it is not empty HINT: If you have manually set citus.multi_shard_modify_mode to 'sequential', try with 'parallel' option. If that is not the case, try distributing local tables when they are empty. -- make sure that the output isn't too verbose @@ -1441,30 +1273,17 @@ BEGIN; SET LOCAL citus.multi_shard_modify_mode TO 'sequential'; CREATE TABLE test_table_1(id int PRIMARY KEY); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_1_pkey" for table "test_table_1" -DEBUG: building index "test_table_1_pkey" on table "test_table_1" serially INSERT INTO test_table_1 SELECT i FROM generate_series(0,100) i; CREATE TABLE test_table_2(id int PRIMARY KEY, value_1 int, FOREIGN KEY(value_1) REFERENCES test_table_1(id)); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_2_pkey" for table "test_table_2" -DEBUG: building index "test_table_2_pkey" on table "test_table_2" serially INSERT INTO test_table_2 SELECT i, i FROM generate_series(0,100) i; SELECT create_reference_table('test_table_1'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 NOTICE: Copying data from local table... -DEBUG: Copied 101 rows create_reference_table ------------------------ (1 row) SELECT create_distributed_table('test_table_2', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 ERROR: cannot distribute "test_table_2" in sequential mode because it is not empty HINT: If you have manually set citus.multi_shard_modify_mode to 'sequential', try with 'parallel' option. If that is not the case, try distributing local tables when they are empty. @@ -1479,28 +1298,14 @@ COMMIT; BEGIN; CREATE TABLE test_table_1(id int PRIMARY KEY); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_1_pkey" for table "test_table_1" -DEBUG: building index "test_table_1_pkey" on table "test_table_1" serially CREATE TABLE test_table_2(id int PRIMARY KEY, value_1 int, FOREIGN KEY(value_1) REFERENCES test_table_1(id)); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_2_pkey" for table "test_table_2" -DEBUG: building index "test_table_2_pkey" on table "test_table_2" serially SELECT create_reference_table('test_table_1'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 -DEBUG: switching to sequential query execution mode -DETAIL: Reference relation "test_table_1" is modified, which might lead to data inconsistencies or distributed deadlocks via parallel accesses to hash distributed relations due to foreign keys. Any parallel modification to those hash distributed relations in the same transaction can only be executed in sequential query execution mode create_reference_table ------------------------ (1 row) SELECT create_distributed_table('test_table_2', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_distributed_table -------------------------- @@ -1508,9 +1313,7 @@ DETAIL: NOTICE from localhost:57637 -- and maybe some other test CREATE INDEX i1 ON test_table_1(id); -DEBUG: building index "i1" on table "test_table_1" serially ALTER TABLE test_table_2 ADD CONSTRAINT check_val CHECK (id > 0); -DEBUG: verifying table "test_table_2" SELECT count(*) FROM test_table_2; count ------- @@ -1655,11 +1458,8 @@ DEBUG: Plan 184 query after replacing subqueries and CTEs: DELETE FROM test_fke ROLLBACK; RESET client_min_messages; +\set VERBOSITY terse DROP SCHEMA test_fkey_to_ref_in_tx CASCADE; NOTICE: drop cascades to 5 other objects -DETAIL: drop cascades to table transitive_reference_table -drop cascades to table on_update_fkey_table -drop cascades to table unrelated_dist_table -drop cascades to table reference_table -drop cascades to table distributed_table +\set VERBOSITY default SET search_path TO public; diff --git a/src/test/regress/expected/foreign_key_restriction_enforcement_0.out b/src/test/regress/expected/foreign_key_restriction_enforcement_0.out index 0c461a3ca..07855c836 100644 --- a/src/test/regress/expected/foreign_key_restriction_enforcement_0.out +++ b/src/test/regress/expected/foreign_key_restriction_enforcement_0.out @@ -817,6 +817,8 @@ ERROR: cannot execute DDL on reference relation "transitive_reference_table" be HINT: Try re-running the transaction with "SET LOCAL citus.multi_shard_modify_mode TO 'sequential';" ROLLBACK; -- case 4.5: SELECT to a dist table is follwed by a TRUNCATE +\set VERBOSITY terse +SET client_min_messages to LOG; BEGIN; SELECT count(*) FROM on_update_fkey_table WHERE value_1 = 99; count @@ -825,11 +827,8 @@ BEGIN; (1 row) TRUNCATE reference_table CASCADE; -DEBUG: switching to sequential query execution mode -DETAIL: Reference relation "reference_table" is modified, which might lead to data inconsistencies or distributed deadlocks via parallel accesses to hash distributed relations due to foreign keys. Any parallel modification to those hash distributed relations in the same transaction can only be executed in sequential query execution mode NOTICE: truncate cascades to table "on_update_fkey_table" ERROR: cannot execute DDL on reference relation "reference_table" because there was a parallel SELECT access to distributed relation "on_update_fkey_table" in the same transaction -HINT: Try re-running the transaction with "SET LOCAL citus.multi_shard_modify_mode TO 'sequential';" ROLLBACK; BEGIN; SELECT count(*) FROM on_update_fkey_table WHERE value_1 = 99; @@ -839,12 +838,9 @@ BEGIN; (1 row) TRUNCATE transitive_reference_table CASCADE; -DEBUG: switching to sequential query execution mode -DETAIL: Reference relation "transitive_reference_table" is modified, which might lead to data inconsistencies or distributed deadlocks via parallel accesses to hash distributed relations due to foreign keys. Any parallel modification to those hash distributed relations in the same transaction can only be executed in sequential query execution mode NOTICE: truncate cascades to table "reference_table" NOTICE: truncate cascades to table "on_update_fkey_table" ERROR: cannot execute DDL on reference relation "transitive_reference_table" because there was a parallel SELECT access to distributed relation "on_update_fkey_table" in the same transaction -HINT: Try re-running the transaction with "SET LOCAL citus.multi_shard_modify_mode TO 'sequential';" ROLLBACK; -- case 4.6: Router SELECT to a dist table is followed by a TRUNCATE BEGIN; @@ -855,19 +851,7 @@ BEGIN; (1 row) TRUNCATE reference_table CASCADE; -DEBUG: switching to sequential query execution mode -DETAIL: Reference relation "reference_table" is modified, which might lead to data inconsistencies or distributed deadlocks via parallel accesses to hash distributed relations due to foreign keys. Any parallel modification to those hash distributed relations in the same transaction can only be executed in sequential query execution mode NOTICE: truncate cascades to table "on_update_fkey_table" -DEBUG: truncate cascades to table "on_update_fkey_table_2380003" -DETAIL: NOTICE from localhost:57638 -DEBUG: truncate cascades to table "on_update_fkey_table_2380005" -DETAIL: NOTICE from localhost:57638 -DEBUG: truncate cascades to table "on_update_fkey_table_2380002" -DETAIL: NOTICE from localhost:57637 -DEBUG: truncate cascades to table "on_update_fkey_table_2380004" -DETAIL: NOTICE from localhost:57637 -DEBUG: building index "reference_table_pkey" on table "reference_table" -DEBUG: building index "on_update_fkey_table_pkey" on table "on_update_fkey_table" ROLLBACK; BEGIN; SELECT count(*) FROM on_update_fkey_table WHERE id = 9; @@ -877,34 +861,11 @@ BEGIN; (1 row) TRUNCATE transitive_reference_table CASCADE; -DEBUG: switching to sequential query execution mode -DETAIL: Reference relation "transitive_reference_table" is modified, which might lead to data inconsistencies or distributed deadlocks via parallel accesses to hash distributed relations due to foreign keys. Any parallel modification to those hash distributed relations in the same transaction can only be executed in sequential query execution mode NOTICE: truncate cascades to table "reference_table" NOTICE: truncate cascades to table "on_update_fkey_table" -DEBUG: truncate cascades to table "reference_table_2380001" -DETAIL: NOTICE from localhost:57638 -DEBUG: truncate cascades to table "on_update_fkey_table_2380003" -DETAIL: NOTICE from localhost:57638 -DEBUG: truncate cascades to table "on_update_fkey_table_2380005" -DETAIL: NOTICE from localhost:57638 -DEBUG: truncate cascades to table "reference_table_2380001" -DETAIL: NOTICE from localhost:57637 -DEBUG: truncate cascades to table "on_update_fkey_table_2380002" -DETAIL: NOTICE from localhost:57637 -DEBUG: truncate cascades to table "on_update_fkey_table_2380004" -DETAIL: NOTICE from localhost:57637 -DEBUG: truncate cascades to table "on_update_fkey_table_2380002" -DETAIL: NOTICE from localhost:57637 -DEBUG: truncate cascades to table "on_update_fkey_table_2380004" -DETAIL: NOTICE from localhost:57637 -DEBUG: truncate cascades to table "on_update_fkey_table_2380003" -DETAIL: NOTICE from localhost:57638 -DEBUG: truncate cascades to table "on_update_fkey_table_2380005" -DETAIL: NOTICE from localhost:57638 -DEBUG: building index "transitive_reference_table_pkey" on table "transitive_reference_table" -DEBUG: building index "reference_table_pkey" on table "reference_table" -DEBUG: building index "on_update_fkey_table_pkey" on table "on_update_fkey_table" ROLLBACK; +RESET client_min_messages; +\set VERBOSITY default -- case 5.1: Parallel UPDATE on distributed table follow by a SELECT BEGIN; UPDATE on_update_fkey_table SET value_1 = 16 WHERE value_1 = 15; @@ -954,18 +915,12 @@ ROLLBACK; BEGIN; UPDATE on_update_fkey_table SET value_1 = 16 WHERE value_1 = 15; ALTER TABLE reference_table ALTER COLUMN id SET DATA TYPE smallint; -DEBUG: rewriting table "reference_table" -DEBUG: building index "reference_table_pkey" on table "reference_table" -DEBUG: validating foreign key constraint "fkey" ERROR: cannot execute DDL on reference relation "reference_table" because there was a parallel DML access to distributed relation "on_update_fkey_table" in the same transaction HINT: Try re-running the transaction with "SET LOCAL citus.multi_shard_modify_mode TO 'sequential';" ROLLBACK; BEGIN; UPDATE on_update_fkey_table SET value_1 = 16 WHERE value_1 = 15; ALTER TABLE transitive_reference_table ALTER COLUMN id SET DATA TYPE smallint; -DEBUG: rewriting table "transitive_reference_table" -DEBUG: building index "transitive_reference_table_pkey" on table "transitive_reference_table" -DEBUG: validating foreign key constraint "fkey" ERROR: cannot execute DDL on reference relation "transitive_reference_table" because there was a parallel DML access to distributed relation "on_update_fkey_table" in the same transaction HINT: Try re-running the transaction with "SET LOCAL citus.multi_shard_modify_mode TO 'sequential';" ROLLBACK; @@ -985,16 +940,10 @@ ROLLBACK; -- case 6:2: Related parallel DDL on distributed table followed by SELECT on ref. table BEGIN; ALTER TABLE on_update_fkey_table ALTER COLUMN value_1 SET DATA TYPE smallint; -DEBUG: rewriting table "on_update_fkey_table" -DEBUG: building index "on_update_fkey_table_pkey" on table "on_update_fkey_table" -DEBUG: validating foreign key constraint "fkey" UPDATE reference_table SET id = 160 WHERE id = 15; ROLLBACK; BEGIN; ALTER TABLE on_update_fkey_table ALTER COLUMN value_1 SET DATA TYPE smallint; -DEBUG: rewriting table "on_update_fkey_table" -DEBUG: building index "on_update_fkey_table_pkey" on table "on_update_fkey_table" -DEBUG: validating foreign key constraint "fkey" UPDATE transitive_reference_table SET id = 160 WHERE id = 15; ROLLBACK; -- case 6:3: Unrelated parallel DDL on distributed table followed by UPDATE on ref. table @@ -1090,26 +1039,14 @@ ERROR: current transaction is aborted, commands ignored until end of transactio ROLLBACK; BEGIN; CREATE TABLE test_table_1(id int PRIMARY KEY); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_1_pkey" for table "test_table_1" -DEBUG: building index "test_table_1_pkey" on table "test_table_1" SELECT create_reference_table('test_table_1'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_reference_table ------------------------ (1 row) CREATE TABLE test_table_2(id int PRIMARY KEY, value_1 int, FOREIGN KEY(value_1) REFERENCES test_table_1(id)); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_2_pkey" for table "test_table_2" -DEBUG: building index "test_table_2_pkey" on table "test_table_2" SELECT create_distributed_table('test_table_2', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_distributed_table -------------------------- @@ -1123,39 +1060,21 @@ ROLLBACK; -- already executed a parallel query BEGIN; CREATE TABLE test_table_1(id int PRIMARY KEY); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_1_pkey" for table "test_table_1" -DEBUG: building index "test_table_1_pkey" on table "test_table_1" SELECT create_reference_table('test_table_1'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_reference_table ------------------------ (1 row) CREATE TABLE tt4(id int PRIMARY KEY, value_1 int, FOREIGN KEY(id) REFERENCES tt4(id)); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "tt4_pkey" for table "tt4" -DEBUG: building index "tt4_pkey" on table "tt4" SELECT create_distributed_table('tt4', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_distributed_table -------------------------- (1 row) CREATE TABLE test_table_2(id int PRIMARY KEY, value_1 int, FOREIGN KEY(value_1) REFERENCES test_table_1(id), FOREIGN KEY(id) REFERENCES tt4(id)); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_2_pkey" for table "test_table_2" -DEBUG: building index "test_table_2_pkey" on table "test_table_2" SELECT create_distributed_table('test_table_2', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 ERROR: cannot distribute relation "test_table_2" in this transaction because it has a foreign key to a reference table DETAIL: If a hash distributed table has a foreign key to a reference table, it has to be created in sequential mode before any parallel commands have been executed in the same transaction HINT: Try re-running the transaction with "SET LOCAL citus.multi_shard_modify_mode TO 'sequential';" @@ -1170,39 +1089,21 @@ ROLLBACK; BEGIN; SET LOCAL citus.multi_shard_modify_mode TO 'sequential'; CREATE TABLE test_table_1(id int PRIMARY KEY); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_1_pkey" for table "test_table_1" -DEBUG: building index "test_table_1_pkey" on table "test_table_1" SELECT create_reference_table('test_table_1'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_reference_table ------------------------ (1 row) CREATE TABLE tt4(id int PRIMARY KEY, value_1 int, FOREIGN KEY(id) REFERENCES tt4(id)); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "tt4_pkey" for table "tt4" -DEBUG: building index "tt4_pkey" on table "tt4" SELECT create_distributed_table('tt4', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_distributed_table -------------------------- (1 row) CREATE TABLE test_table_2(id int PRIMARY KEY, value_1 int, FOREIGN KEY(value_1) REFERENCES test_table_1(id), FOREIGN KEY(id) REFERENCES tt4(id)); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_2_pkey" for table "test_table_2" -DEBUG: building index "test_table_2_pkey" on table "test_table_2" SELECT create_distributed_table('test_table_2', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_distributed_table -------------------------- @@ -1218,26 +1119,14 @@ ROLLBACK; BEGIN; CREATE TABLE test_table_1(id int PRIMARY KEY); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_1_pkey" for table "test_table_1" -DEBUG: building index "test_table_1_pkey" on table "test_table_1" SELECT create_reference_table('test_table_1'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_reference_table ------------------------ (1 row) CREATE TABLE test_table_2(id int PRIMARY KEY, value_1 int); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_2_pkey" for table "test_table_2" -DEBUG: building index "test_table_2_pkey" on table "test_table_2" SELECT create_distributed_table('test_table_2', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_distributed_table -------------------------- @@ -1258,26 +1147,14 @@ BEGIN; SET LOCAL citus.multi_shard_modify_mode TO 'sequential'; CREATE TABLE test_table_1(id int PRIMARY KEY); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_1_pkey" for table "test_table_1" -DEBUG: building index "test_table_1_pkey" on table "test_table_1" SELECT create_reference_table('test_table_1'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_reference_table ------------------------ (1 row) CREATE TABLE test_table_2(id int PRIMARY KEY, value_1 int); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_2_pkey" for table "test_table_2" -DEBUG: building index "test_table_2_pkey" on table "test_table_2" SELECT create_distributed_table('test_table_2', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_distributed_table -------------------------- @@ -1293,26 +1170,14 @@ COMMIT; -- changed BEGIN; CREATE TABLE test_table_2(id int PRIMARY KEY, value_1 int); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_2_pkey" for table "test_table_2" -DEBUG: building index "test_table_2_pkey" on table "test_table_2" SELECT create_distributed_table('test_table_2', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_distributed_table -------------------------- (1 row) CREATE TABLE test_table_1(id int PRIMARY KEY); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_1_pkey" for table "test_table_1" -DEBUG: building index "test_table_1_pkey" on table "test_table_1" SELECT create_reference_table('test_table_1'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_reference_table ------------------------ @@ -1332,26 +1197,14 @@ ROLLBACK; BEGIN; SET LOCAL citus.multi_shard_modify_mode TO 'sequential'; CREATE TABLE test_table_2(id int PRIMARY KEY, value_1 int); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_2_pkey" for table "test_table_2" -DEBUG: building index "test_table_2_pkey" on table "test_table_2" SELECT create_distributed_table('test_table_2', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_distributed_table -------------------------- (1 row) CREATE TABLE test_table_1(id int PRIMARY KEY); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_1_pkey" for table "test_table_1" -DEBUG: building index "test_table_1_pkey" on table "test_table_1" SELECT create_reference_table('test_table_1'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_reference_table ------------------------ @@ -1374,13 +1227,7 @@ BEGIN; SET LOCAL citus.multi_shard_modify_mode TO 'sequential'; CREATE TABLE test_table_2(id int PRIMARY KEY, value_1 int); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_2_pkey" for table "test_table_2" -DEBUG: building index "test_table_2_pkey" on table "test_table_2" SELECT create_distributed_table('test_table_2', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 ERROR: cannot distribute relation "test_table_2" in this transaction because it has a foreign key to a reference table DETAIL: If a hash distributed table has a foreign key to a reference table, it has to be created in sequential mode before any parallel commands have been executed in the same transaction HINT: Try re-running the transaction with "SET LOCAL citus.multi_shard_modify_mode TO 'sequential';" @@ -1401,32 +1248,17 @@ ROLLBACK; BEGIN; CREATE TABLE test_table_1(id int PRIMARY KEY); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_1_pkey" for table "test_table_1" -DEBUG: building index "test_table_1_pkey" on table "test_table_1" INSERT INTO test_table_1 SELECT i FROM generate_series(0,100) i; CREATE TABLE test_table_2(id int PRIMARY KEY, value_1 int, FOREIGN KEY(value_1) REFERENCES test_table_1(id)); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_2_pkey" for table "test_table_2" -DEBUG: building index "test_table_2_pkey" on table "test_table_2" INSERT INTO test_table_2 SELECT i, i FROM generate_series(0,100) i; SELECT create_reference_table('test_table_1'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 -DEBUG: switching to sequential query execution mode -DETAIL: Reference relation "test_table_1" is modified, which might lead to data inconsistencies or distributed deadlocks via parallel accesses to hash distributed relations due to foreign keys. Any parallel modification to those hash distributed relations in the same transaction can only be executed in sequential query execution mode NOTICE: Copying data from local table... -DEBUG: Copied 101 rows create_reference_table ------------------------ (1 row) SELECT create_distributed_table('test_table_2', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 ERROR: cannot distribute "test_table_2" in sequential mode because it is not empty HINT: If you have manually set citus.multi_shard_modify_mode to 'sequential', try with 'parallel' option. If that is not the case, try distributing local tables when they are empty. -- make sure that the output isn't too verbose @@ -1441,30 +1273,17 @@ BEGIN; SET LOCAL citus.multi_shard_modify_mode TO 'sequential'; CREATE TABLE test_table_1(id int PRIMARY KEY); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_1_pkey" for table "test_table_1" -DEBUG: building index "test_table_1_pkey" on table "test_table_1" INSERT INTO test_table_1 SELECT i FROM generate_series(0,100) i; CREATE TABLE test_table_2(id int PRIMARY KEY, value_1 int, FOREIGN KEY(value_1) REFERENCES test_table_1(id)); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_2_pkey" for table "test_table_2" -DEBUG: building index "test_table_2_pkey" on table "test_table_2" INSERT INTO test_table_2 SELECT i, i FROM generate_series(0,100) i; SELECT create_reference_table('test_table_1'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 NOTICE: Copying data from local table... -DEBUG: Copied 101 rows create_reference_table ------------------------ (1 row) SELECT create_distributed_table('test_table_2', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 ERROR: cannot distribute "test_table_2" in sequential mode because it is not empty HINT: If you have manually set citus.multi_shard_modify_mode to 'sequential', try with 'parallel' option. If that is not the case, try distributing local tables when they are empty. @@ -1479,28 +1298,14 @@ COMMIT; BEGIN; CREATE TABLE test_table_1(id int PRIMARY KEY); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_1_pkey" for table "test_table_1" -DEBUG: building index "test_table_1_pkey" on table "test_table_1" CREATE TABLE test_table_2(id int PRIMARY KEY, value_1 int, FOREIGN KEY(value_1) REFERENCES test_table_1(id)); -DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_table_2_pkey" for table "test_table_2" -DEBUG: building index "test_table_2_pkey" on table "test_table_2" SELECT create_reference_table('test_table_1'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 -DEBUG: switching to sequential query execution mode -DETAIL: Reference relation "test_table_1" is modified, which might lead to data inconsistencies or distributed deadlocks via parallel accesses to hash distributed relations due to foreign keys. Any parallel modification to those hash distributed relations in the same transaction can only be executed in sequential query execution mode create_reference_table ------------------------ (1 row) SELECT create_distributed_table('test_table_2', 'id'); -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57638 -DEBUG: schema "test_fkey_to_ref_in_tx" already exists, skipping -DETAIL: NOTICE from localhost:57637 create_distributed_table -------------------------- @@ -1508,9 +1313,7 @@ DETAIL: NOTICE from localhost:57637 -- and maybe some other test CREATE INDEX i1 ON test_table_1(id); -DEBUG: building index "i1" on table "test_table_1" ALTER TABLE test_table_2 ADD CONSTRAINT check_val CHECK (id > 0); -DEBUG: verifying table "test_table_2" SELECT count(*) FROM test_table_2; count ------- @@ -1655,11 +1458,8 @@ DEBUG: Plan 184 query after replacing subqueries and CTEs: DELETE FROM test_fke ROLLBACK; RESET client_min_messages; +\set VERBOSITY terse DROP SCHEMA test_fkey_to_ref_in_tx CASCADE; NOTICE: drop cascades to 5 other objects -DETAIL: drop cascades to table transitive_reference_table -drop cascades to table on_update_fkey_table -drop cascades to table unrelated_dist_table -drop cascades to table reference_table -drop cascades to table distributed_table +\set VERBOSITY default SET search_path TO public; diff --git a/src/test/regress/expected/multi_create_shards.out b/src/test/regress/expected/multi_create_shards.out index fa6b7a179..254a15619 100644 --- a/src/test/regress/expected/multi_create_shards.out +++ b/src/test/regress/expected/multi_create_shards.out @@ -39,13 +39,9 @@ CREATE TABLE table_to_distribute ( json_data json, test_type_data dummy_type ); --- use the table WITH (OIDS) set -ALTER TABLE table_to_distribute SET WITH OIDS; SELECT create_distributed_table('table_to_distribute', 'id', 'hash'); -ERROR: cannot distribute relation: table_to_distribute -DETAIL: Distributed relations must not specify the WITH (OIDS) option in their definitions. --- revert WITH (OIDS) from above -ALTER TABLE table_to_distribute SET WITHOUT OIDS; +ERROR: cannot create constraint on "table_to_distribute" +DETAIL: Distributed relations cannot have UNIQUE, EXCLUDE, or PRIMARY KEY constraints that do not include the partition column (with an equality operator if EXCLUDE). -- use an index instead of table name SELECT create_distributed_table('table_to_distribute_pkey', 'id', 'hash'); ERROR: table_to_distribute_pkey is not a regular, foreign or partitioned table diff --git a/src/test/regress/expected/multi_master_protocol.out b/src/test/regress/expected/multi_master_protocol.out index c67941706..0381679aa 100644 --- a/src/test/regress/expected/multi_master_protocol.out +++ b/src/test/regress/expected/multi_master_protocol.out @@ -10,13 +10,13 @@ SELECT part_storage_type, part_key, part_replica_count, part_max_size, t | l_orderkey | 2 | 1536000 | 2 (1 row) -SELECT * FROM master_get_table_ddl_events('lineitem'); +SELECT * FROM master_get_table_ddl_events('lineitem') order by 1; master_get_table_ddl_events ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - CREATE TABLE public.lineitem (l_orderkey bigint NOT NULL, l_partkey integer NOT NULL, l_suppkey integer NOT NULL, l_linenumber integer NOT NULL, l_quantity numeric(15,2) NOT NULL, l_extendedprice numeric(15,2) NOT NULL, l_discount numeric(15,2) NOT NULL, l_tax numeric(15,2) NOT NULL, l_returnflag character(1) NOT NULL, l_linestatus character(1) NOT NULL, l_shipdate date NOT NULL, l_commitdate date NOT NULL, l_receiptdate date NOT NULL, l_shipinstruct character(25) NOT NULL, l_shipmode character(10) NOT NULL, l_comment character varying(44) NOT NULL) + ALTER TABLE public.lineitem ADD CONSTRAINT lineitem_pkey PRIMARY KEY (l_orderkey, l_linenumber) ALTER TABLE public.lineitem OWNER TO postgres CREATE INDEX lineitem_time_index ON public.lineitem USING btree (l_shipdate) TABLESPACE pg_default - ALTER TABLE public.lineitem ADD CONSTRAINT lineitem_pkey PRIMARY KEY (l_orderkey, l_linenumber) + CREATE TABLE public.lineitem (l_orderkey bigint NOT NULL, l_partkey integer NOT NULL, l_suppkey integer NOT NULL, l_linenumber integer NOT NULL, l_quantity numeric(15,2) NOT NULL, l_extendedprice numeric(15,2) NOT NULL, l_discount numeric(15,2) NOT NULL, l_tax numeric(15,2) NOT NULL, l_returnflag character(1) NOT NULL, l_linestatus character(1) NOT NULL, l_shipdate date NOT NULL, l_commitdate date NOT NULL, l_receiptdate date NOT NULL, l_shipinstruct character(25) NOT NULL, l_shipmode character(10) NOT NULL, l_comment character varying(44) NOT NULL) (4 rows) SELECT * FROM master_get_new_shardid(); diff --git a/src/test/regress/expected/multi_metadata_sync.out b/src/test/regress/expected/multi_metadata_sync.out index dd3999c02..9a68e5f1f 100644 --- a/src/test/regress/expected/multi_metadata_sync.out +++ b/src/test/regress/expected/multi_metadata_sync.out @@ -26,12 +26,12 @@ SELECT * FROM pg_dist_partition WHERE partmethod='h' AND repmodel='s'; -- Show that, with no MX tables, metadata snapshot contains only the delete commands, -- pg_dist_node entries and reference tables -SELECT unnest(master_metadata_snapshot()); +SELECT unnest(master_metadata_snapshot()) order by 1; unnest ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + INSERT INTO pg_dist_node (nodeid, groupid, nodename, nodeport, noderack, hasmetadata, isactive, noderole, nodecluster) VALUES (1, 1, 'localhost', 57637, 'default', FALSE, TRUE, 'primary'::noderole, 'default'),(2, 2, 'localhost', 57638, 'default', FALSE, TRUE, 'primary'::noderole, 'default') SELECT worker_drop_distributed_table(logicalrelid::regclass::text) FROM pg_dist_partition TRUNCATE pg_dist_node CASCADE - INSERT INTO pg_dist_node (nodeid, groupid, nodename, nodeport, noderack, hasmetadata, isactive, noderole, nodecluster) VALUES (1, 1, 'localhost', 57637, 'default', FALSE, TRUE, 'primary'::noderole, 'default'),(2, 2, 'localhost', 57638, 'default', FALSE, TRUE, 'primary'::noderole, 'default') (3 rows) -- Create a test table with constraints and SERIAL @@ -52,43 +52,43 @@ SELECT master_create_worker_shards('mx_test_table', 8, 1); -- considered as an MX table UPDATE pg_dist_partition SET repmodel='s' WHERE logicalrelid='mx_test_table'::regclass; -- Show that the created MX table is included in the metadata snapshot -SELECT unnest(master_metadata_snapshot()); +SELECT unnest(master_metadata_snapshot()) order by 1; unnest -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - SELECT worker_drop_distributed_table(logicalrelid::regclass::text) FROM pg_dist_partition - TRUNCATE pg_dist_node CASCADE - INSERT INTO pg_dist_node (nodeid, groupid, nodename, nodeport, noderack, hasmetadata, isactive, noderole, nodecluster) VALUES (1, 1, 'localhost', 57637, 'default', FALSE, TRUE, 'primary'::noderole, 'default'),(2, 2, 'localhost', 57638, 'default', FALSE, TRUE, 'primary'::noderole, 'default') - SELECT worker_apply_sequence_command ('CREATE SEQUENCE IF NOT EXISTS mx_test_table_col_3_seq INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 NO CYCLE') ALTER SEQUENCE public.mx_test_table_col_3_seq OWNER TO postgres - CREATE TABLE public.mx_test_table (col_1 integer, col_2 text NOT NULL, col_3 bigint DEFAULT nextval('public.mx_test_table_col_3_seq'::regclass) NOT NULL) - ALTER TABLE public.mx_test_table OWNER TO postgres ALTER TABLE public.mx_test_table ADD CONSTRAINT mx_test_table_col_1_key UNIQUE (col_1) ALTER TABLE public.mx_test_table OWNER TO postgres + ALTER TABLE public.mx_test_table OWNER TO postgres + CREATE TABLE public.mx_test_table (col_1 integer, col_2 text NOT NULL, col_3 bigint DEFAULT nextval('public.mx_test_table_col_3_seq'::regclass) NOT NULL) + INSERT INTO pg_dist_node (nodeid, groupid, nodename, nodeport, noderack, hasmetadata, isactive, noderole, nodecluster) VALUES (1, 1, 'localhost', 57637, 'default', FALSE, TRUE, 'primary'::noderole, 'default'),(2, 2, 'localhost', 57638, 'default', FALSE, TRUE, 'primary'::noderole, 'default') INSERT INTO pg_dist_partition (logicalrelid, partmethod, partkey, colocationid, repmodel) VALUES ('public.mx_test_table'::regclass, 'h', column_name_to_column('public.mx_test_table','col_1'), 0, 's') - SELECT worker_create_truncate_trigger('public.mx_test_table') INSERT INTO pg_dist_placement (shardid, shardstate, shardlength, groupid, placementid) VALUES (1310000, 1, 0, 1, 100000),(1310001, 1, 0, 2, 100001),(1310002, 1, 0, 1, 100002),(1310003, 1, 0, 2, 100003),(1310004, 1, 0, 1, 100004),(1310005, 1, 0, 2, 100005),(1310006, 1, 0, 1, 100006),(1310007, 1, 0, 2, 100007) INSERT INTO pg_dist_shard (logicalrelid, shardid, shardstorage, shardminvalue, shardmaxvalue) VALUES ('public.mx_test_table'::regclass, 1310000, 't', '-2147483648', '-1610612737'),('public.mx_test_table'::regclass, 1310001, 't', '-1610612736', '-1073741825'),('public.mx_test_table'::regclass, 1310002, 't', '-1073741824', '-536870913'),('public.mx_test_table'::regclass, 1310003, 't', '-536870912', '-1'),('public.mx_test_table'::regclass, 1310004, 't', '0', '536870911'),('public.mx_test_table'::regclass, 1310005, 't', '536870912', '1073741823'),('public.mx_test_table'::regclass, 1310006, 't', '1073741824', '1610612735'),('public.mx_test_table'::regclass, 1310007, 't', '1610612736', '2147483647') + SELECT worker_apply_sequence_command ('CREATE SEQUENCE IF NOT EXISTS mx_test_table_col_3_seq INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 NO CYCLE') + SELECT worker_create_truncate_trigger('public.mx_test_table') + SELECT worker_drop_distributed_table(logicalrelid::regclass::text) FROM pg_dist_partition + TRUNCATE pg_dist_node CASCADE (13 rows) -- Show that CREATE INDEX commands are included in the metadata snapshot CREATE INDEX mx_index ON mx_test_table(col_2); -SELECT unnest(master_metadata_snapshot()); +SELECT unnest(master_metadata_snapshot()) order by 1; unnest -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - SELECT worker_drop_distributed_table(logicalrelid::regclass::text) FROM pg_dist_partition - TRUNCATE pg_dist_node CASCADE - INSERT INTO pg_dist_node (nodeid, groupid, nodename, nodeport, noderack, hasmetadata, isactive, noderole, nodecluster) VALUES (1, 1, 'localhost', 57637, 'default', FALSE, TRUE, 'primary'::noderole, 'default'),(2, 2, 'localhost', 57638, 'default', FALSE, TRUE, 'primary'::noderole, 'default') - SELECT worker_apply_sequence_command ('CREATE SEQUENCE IF NOT EXISTS mx_test_table_col_3_seq INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 NO CYCLE') ALTER SEQUENCE public.mx_test_table_col_3_seq OWNER TO postgres - CREATE TABLE public.mx_test_table (col_1 integer, col_2 text NOT NULL, col_3 bigint DEFAULT nextval('public.mx_test_table_col_3_seq'::regclass) NOT NULL) - ALTER TABLE public.mx_test_table OWNER TO postgres - CREATE INDEX mx_index ON public.mx_test_table USING btree (col_2) TABLESPACE pg_default ALTER TABLE public.mx_test_table ADD CONSTRAINT mx_test_table_col_1_key UNIQUE (col_1) ALTER TABLE public.mx_test_table OWNER TO postgres + ALTER TABLE public.mx_test_table OWNER TO postgres + CREATE INDEX mx_index ON public.mx_test_table USING btree (col_2) TABLESPACE pg_default + CREATE TABLE public.mx_test_table (col_1 integer, col_2 text NOT NULL, col_3 bigint DEFAULT nextval('public.mx_test_table_col_3_seq'::regclass) NOT NULL) + INSERT INTO pg_dist_node (nodeid, groupid, nodename, nodeport, noderack, hasmetadata, isactive, noderole, nodecluster) VALUES (1, 1, 'localhost', 57637, 'default', FALSE, TRUE, 'primary'::noderole, 'default'),(2, 2, 'localhost', 57638, 'default', FALSE, TRUE, 'primary'::noderole, 'default') INSERT INTO pg_dist_partition (logicalrelid, partmethod, partkey, colocationid, repmodel) VALUES ('public.mx_test_table'::regclass, 'h', column_name_to_column('public.mx_test_table','col_1'), 0, 's') - SELECT worker_create_truncate_trigger('public.mx_test_table') INSERT INTO pg_dist_placement (shardid, shardstate, shardlength, groupid, placementid) VALUES (1310000, 1, 0, 1, 100000),(1310001, 1, 0, 2, 100001),(1310002, 1, 0, 1, 100002),(1310003, 1, 0, 2, 100003),(1310004, 1, 0, 1, 100004),(1310005, 1, 0, 2, 100005),(1310006, 1, 0, 1, 100006),(1310007, 1, 0, 2, 100007) INSERT INTO pg_dist_shard (logicalrelid, shardid, shardstorage, shardminvalue, shardmaxvalue) VALUES ('public.mx_test_table'::regclass, 1310000, 't', '-2147483648', '-1610612737'),('public.mx_test_table'::regclass, 1310001, 't', '-1610612736', '-1073741825'),('public.mx_test_table'::regclass, 1310002, 't', '-1073741824', '-536870913'),('public.mx_test_table'::regclass, 1310003, 't', '-536870912', '-1'),('public.mx_test_table'::regclass, 1310004, 't', '0', '536870911'),('public.mx_test_table'::regclass, 1310005, 't', '536870912', '1073741823'),('public.mx_test_table'::regclass, 1310006, 't', '1073741824', '1610612735'),('public.mx_test_table'::regclass, 1310007, 't', '1610612736', '2147483647') + SELECT worker_apply_sequence_command ('CREATE SEQUENCE IF NOT EXISTS mx_test_table_col_3_seq INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 NO CYCLE') + SELECT worker_create_truncate_trigger('public.mx_test_table') + SELECT worker_drop_distributed_table(logicalrelid::regclass::text) FROM pg_dist_partition + TRUNCATE pg_dist_node CASCADE (14 rows) -- Show that schema changes are included in the metadata snapshot @@ -96,23 +96,23 @@ CREATE SCHEMA mx_testing_schema; ALTER TABLE mx_test_table SET SCHEMA mx_testing_schema; WARNING: not propagating ALTER ... SET SCHEMA commands to worker nodes HINT: Connect to worker nodes directly to manually change schemas of affected objects. -SELECT unnest(master_metadata_snapshot()); +SELECT unnest(master_metadata_snapshot()) order by 1; unnest ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - SELECT worker_drop_distributed_table(logicalrelid::regclass::text) FROM pg_dist_partition - TRUNCATE pg_dist_node CASCADE - INSERT INTO pg_dist_node (nodeid, groupid, nodename, nodeport, noderack, hasmetadata, isactive, noderole, nodecluster) VALUES (1, 1, 'localhost', 57637, 'default', FALSE, TRUE, 'primary'::noderole, 'default'),(2, 2, 'localhost', 57638, 'default', FALSE, TRUE, 'primary'::noderole, 'default') - SELECT worker_apply_sequence_command ('CREATE SEQUENCE IF NOT EXISTS mx_testing_schema.mx_test_table_col_3_seq INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 NO CYCLE') ALTER SEQUENCE mx_testing_schema.mx_test_table_col_3_seq OWNER TO postgres - CREATE TABLE mx_testing_schema.mx_test_table (col_1 integer, col_2 text NOT NULL, col_3 bigint DEFAULT nextval('mx_testing_schema.mx_test_table_col_3_seq'::regclass) NOT NULL) - ALTER TABLE mx_testing_schema.mx_test_table OWNER TO postgres - CREATE INDEX mx_index ON mx_testing_schema.mx_test_table USING btree (col_2) TABLESPACE pg_default ALTER TABLE mx_testing_schema.mx_test_table ADD CONSTRAINT mx_test_table_col_1_key UNIQUE (col_1) ALTER TABLE mx_testing_schema.mx_test_table OWNER TO postgres + ALTER TABLE mx_testing_schema.mx_test_table OWNER TO postgres + CREATE INDEX mx_index ON mx_testing_schema.mx_test_table USING btree (col_2) TABLESPACE pg_default + CREATE TABLE mx_testing_schema.mx_test_table (col_1 integer, col_2 text NOT NULL, col_3 bigint DEFAULT nextval('mx_testing_schema.mx_test_table_col_3_seq'::regclass) NOT NULL) + INSERT INTO pg_dist_node (nodeid, groupid, nodename, nodeport, noderack, hasmetadata, isactive, noderole, nodecluster) VALUES (1, 1, 'localhost', 57637, 'default', FALSE, TRUE, 'primary'::noderole, 'default'),(2, 2, 'localhost', 57638, 'default', FALSE, TRUE, 'primary'::noderole, 'default') INSERT INTO pg_dist_partition (logicalrelid, partmethod, partkey, colocationid, repmodel) VALUES ('mx_testing_schema.mx_test_table'::regclass, 'h', column_name_to_column('mx_testing_schema.mx_test_table','col_1'), 0, 's') - SELECT worker_create_truncate_trigger('mx_testing_schema.mx_test_table') INSERT INTO pg_dist_placement (shardid, shardstate, shardlength, groupid, placementid) VALUES (1310000, 1, 0, 1, 100000),(1310001, 1, 0, 2, 100001),(1310002, 1, 0, 1, 100002),(1310003, 1, 0, 2, 100003),(1310004, 1, 0, 1, 100004),(1310005, 1, 0, 2, 100005),(1310006, 1, 0, 1, 100006),(1310007, 1, 0, 2, 100007) INSERT INTO pg_dist_shard (logicalrelid, shardid, shardstorage, shardminvalue, shardmaxvalue) VALUES ('mx_testing_schema.mx_test_table'::regclass, 1310000, 't', '-2147483648', '-1610612737'),('mx_testing_schema.mx_test_table'::regclass, 1310001, 't', '-1610612736', '-1073741825'),('mx_testing_schema.mx_test_table'::regclass, 1310002, 't', '-1073741824', '-536870913'),('mx_testing_schema.mx_test_table'::regclass, 1310003, 't', '-536870912', '-1'),('mx_testing_schema.mx_test_table'::regclass, 1310004, 't', '0', '536870911'),('mx_testing_schema.mx_test_table'::regclass, 1310005, 't', '536870912', '1073741823'),('mx_testing_schema.mx_test_table'::regclass, 1310006, 't', '1073741824', '1610612735'),('mx_testing_schema.mx_test_table'::regclass, 1310007, 't', '1610612736', '2147483647') + SELECT worker_apply_sequence_command ('CREATE SEQUENCE IF NOT EXISTS mx_testing_schema.mx_test_table_col_3_seq INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 NO CYCLE') + SELECT worker_create_truncate_trigger('mx_testing_schema.mx_test_table') + SELECT worker_drop_distributed_table(logicalrelid::regclass::text) FROM pg_dist_partition + TRUNCATE pg_dist_node CASCADE (14 rows) -- Show that append distributed tables are not included in the metadata snapshot @@ -124,44 +124,44 @@ SELECT master_create_distributed_table('non_mx_test_table', 'col_1', 'append'); (1 row) UPDATE pg_dist_partition SET repmodel='s' WHERE logicalrelid='non_mx_test_table'::regclass; -SELECT unnest(master_metadata_snapshot()); +SELECT unnest(master_metadata_snapshot()) order by 1; unnest ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - SELECT worker_drop_distributed_table(logicalrelid::regclass::text) FROM pg_dist_partition - TRUNCATE pg_dist_node CASCADE - INSERT INTO pg_dist_node (nodeid, groupid, nodename, nodeport, noderack, hasmetadata, isactive, noderole, nodecluster) VALUES (1, 1, 'localhost', 57637, 'default', FALSE, TRUE, 'primary'::noderole, 'default'),(2, 2, 'localhost', 57638, 'default', FALSE, TRUE, 'primary'::noderole, 'default') - SELECT worker_apply_sequence_command ('CREATE SEQUENCE IF NOT EXISTS mx_testing_schema.mx_test_table_col_3_seq INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 NO CYCLE') ALTER SEQUENCE mx_testing_schema.mx_test_table_col_3_seq OWNER TO postgres - CREATE TABLE mx_testing_schema.mx_test_table (col_1 integer, col_2 text NOT NULL, col_3 bigint DEFAULT nextval('mx_testing_schema.mx_test_table_col_3_seq'::regclass) NOT NULL) - ALTER TABLE mx_testing_schema.mx_test_table OWNER TO postgres - CREATE INDEX mx_index ON mx_testing_schema.mx_test_table USING btree (col_2) TABLESPACE pg_default ALTER TABLE mx_testing_schema.mx_test_table ADD CONSTRAINT mx_test_table_col_1_key UNIQUE (col_1) ALTER TABLE mx_testing_schema.mx_test_table OWNER TO postgres + ALTER TABLE mx_testing_schema.mx_test_table OWNER TO postgres + CREATE INDEX mx_index ON mx_testing_schema.mx_test_table USING btree (col_2) TABLESPACE pg_default + CREATE TABLE mx_testing_schema.mx_test_table (col_1 integer, col_2 text NOT NULL, col_3 bigint DEFAULT nextval('mx_testing_schema.mx_test_table_col_3_seq'::regclass) NOT NULL) + INSERT INTO pg_dist_node (nodeid, groupid, nodename, nodeport, noderack, hasmetadata, isactive, noderole, nodecluster) VALUES (1, 1, 'localhost', 57637, 'default', FALSE, TRUE, 'primary'::noderole, 'default'),(2, 2, 'localhost', 57638, 'default', FALSE, TRUE, 'primary'::noderole, 'default') INSERT INTO pg_dist_partition (logicalrelid, partmethod, partkey, colocationid, repmodel) VALUES ('mx_testing_schema.mx_test_table'::regclass, 'h', column_name_to_column('mx_testing_schema.mx_test_table','col_1'), 0, 's') - SELECT worker_create_truncate_trigger('mx_testing_schema.mx_test_table') INSERT INTO pg_dist_placement (shardid, shardstate, shardlength, groupid, placementid) VALUES (1310000, 1, 0, 1, 100000),(1310001, 1, 0, 2, 100001),(1310002, 1, 0, 1, 100002),(1310003, 1, 0, 2, 100003),(1310004, 1, 0, 1, 100004),(1310005, 1, 0, 2, 100005),(1310006, 1, 0, 1, 100006),(1310007, 1, 0, 2, 100007) INSERT INTO pg_dist_shard (logicalrelid, shardid, shardstorage, shardminvalue, shardmaxvalue) VALUES ('mx_testing_schema.mx_test_table'::regclass, 1310000, 't', '-2147483648', '-1610612737'),('mx_testing_schema.mx_test_table'::regclass, 1310001, 't', '-1610612736', '-1073741825'),('mx_testing_schema.mx_test_table'::regclass, 1310002, 't', '-1073741824', '-536870913'),('mx_testing_schema.mx_test_table'::regclass, 1310003, 't', '-536870912', '-1'),('mx_testing_schema.mx_test_table'::regclass, 1310004, 't', '0', '536870911'),('mx_testing_schema.mx_test_table'::regclass, 1310005, 't', '536870912', '1073741823'),('mx_testing_schema.mx_test_table'::regclass, 1310006, 't', '1073741824', '1610612735'),('mx_testing_schema.mx_test_table'::regclass, 1310007, 't', '1610612736', '2147483647') + SELECT worker_apply_sequence_command ('CREATE SEQUENCE IF NOT EXISTS mx_testing_schema.mx_test_table_col_3_seq INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 NO CYCLE') + SELECT worker_create_truncate_trigger('mx_testing_schema.mx_test_table') + SELECT worker_drop_distributed_table(logicalrelid::regclass::text) FROM pg_dist_partition + TRUNCATE pg_dist_node CASCADE (14 rows) -- Show that range distributed tables are not included in the metadata snapshot UPDATE pg_dist_partition SET partmethod='r' WHERE logicalrelid='non_mx_test_table'::regclass; -SELECT unnest(master_metadata_snapshot()); +SELECT unnest(master_metadata_snapshot()) order by 1; unnest ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - SELECT worker_drop_distributed_table(logicalrelid::regclass::text) FROM pg_dist_partition - TRUNCATE pg_dist_node CASCADE - INSERT INTO pg_dist_node (nodeid, groupid, nodename, nodeport, noderack, hasmetadata, isactive, noderole, nodecluster) VALUES (1, 1, 'localhost', 57637, 'default', FALSE, TRUE, 'primary'::noderole, 'default'),(2, 2, 'localhost', 57638, 'default', FALSE, TRUE, 'primary'::noderole, 'default') - SELECT worker_apply_sequence_command ('CREATE SEQUENCE IF NOT EXISTS mx_testing_schema.mx_test_table_col_3_seq INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 NO CYCLE') ALTER SEQUENCE mx_testing_schema.mx_test_table_col_3_seq OWNER TO postgres - CREATE TABLE mx_testing_schema.mx_test_table (col_1 integer, col_2 text NOT NULL, col_3 bigint DEFAULT nextval('mx_testing_schema.mx_test_table_col_3_seq'::regclass) NOT NULL) - ALTER TABLE mx_testing_schema.mx_test_table OWNER TO postgres - CREATE INDEX mx_index ON mx_testing_schema.mx_test_table USING btree (col_2) TABLESPACE pg_default ALTER TABLE mx_testing_schema.mx_test_table ADD CONSTRAINT mx_test_table_col_1_key UNIQUE (col_1) ALTER TABLE mx_testing_schema.mx_test_table OWNER TO postgres + ALTER TABLE mx_testing_schema.mx_test_table OWNER TO postgres + CREATE INDEX mx_index ON mx_testing_schema.mx_test_table USING btree (col_2) TABLESPACE pg_default + CREATE TABLE mx_testing_schema.mx_test_table (col_1 integer, col_2 text NOT NULL, col_3 bigint DEFAULT nextval('mx_testing_schema.mx_test_table_col_3_seq'::regclass) NOT NULL) + INSERT INTO pg_dist_node (nodeid, groupid, nodename, nodeport, noderack, hasmetadata, isactive, noderole, nodecluster) VALUES (1, 1, 'localhost', 57637, 'default', FALSE, TRUE, 'primary'::noderole, 'default'),(2, 2, 'localhost', 57638, 'default', FALSE, TRUE, 'primary'::noderole, 'default') INSERT INTO pg_dist_partition (logicalrelid, partmethod, partkey, colocationid, repmodel) VALUES ('mx_testing_schema.mx_test_table'::regclass, 'h', column_name_to_column('mx_testing_schema.mx_test_table','col_1'), 0, 's') - SELECT worker_create_truncate_trigger('mx_testing_schema.mx_test_table') INSERT INTO pg_dist_placement (shardid, shardstate, shardlength, groupid, placementid) VALUES (1310000, 1, 0, 1, 100000),(1310001, 1, 0, 2, 100001),(1310002, 1, 0, 1, 100002),(1310003, 1, 0, 2, 100003),(1310004, 1, 0, 1, 100004),(1310005, 1, 0, 2, 100005),(1310006, 1, 0, 1, 100006),(1310007, 1, 0, 2, 100007) INSERT INTO pg_dist_shard (logicalrelid, shardid, shardstorage, shardminvalue, shardmaxvalue) VALUES ('mx_testing_schema.mx_test_table'::regclass, 1310000, 't', '-2147483648', '-1610612737'),('mx_testing_schema.mx_test_table'::regclass, 1310001, 't', '-1610612736', '-1073741825'),('mx_testing_schema.mx_test_table'::regclass, 1310002, 't', '-1073741824', '-536870913'),('mx_testing_schema.mx_test_table'::regclass, 1310003, 't', '-536870912', '-1'),('mx_testing_schema.mx_test_table'::regclass, 1310004, 't', '0', '536870911'),('mx_testing_schema.mx_test_table'::regclass, 1310005, 't', '536870912', '1073741823'),('mx_testing_schema.mx_test_table'::regclass, 1310006, 't', '1073741824', '1610612735'),('mx_testing_schema.mx_test_table'::regclass, 1310007, 't', '1610612736', '2147483647') + SELECT worker_apply_sequence_command ('CREATE SEQUENCE IF NOT EXISTS mx_testing_schema.mx_test_table_col_3_seq INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 NO CYCLE') + SELECT worker_create_truncate_trigger('mx_testing_schema.mx_test_table') + SELECT worker_drop_distributed_table(logicalrelid::regclass::text) FROM pg_dist_partition + TRUNCATE pg_dist_node CASCADE (14 rows) -- Test start_metadata_sync_to_node UDF diff --git a/src/test/regress/expected/multi_partitioning.out b/src/test/regress/expected/multi_partitioning.out index 9089d942c..6aee55f4a 100644 --- a/src/test/regress/expected/multi_partitioning.out +++ b/src/test/regress/expected/multi_partitioning.out @@ -4,12 +4,11 @@ SET citus.next_shard_id TO 1660000; SET citus.shard_count TO 4; SET citus.shard_replication_factor TO 1; --- print major version number for version-specific tests SHOW server_version \gset -SELECT substring(:'server_version', '\d+')::int AS server_version; - server_version ----------------- - 11 +SELECT substring(:'server_version', '\d+')::int > 10 AS server_version_above_ten; + server_version_above_ten +-------------------------- + t (1 row) -- @@ -540,7 +539,7 @@ CREATE INDEX partitioning_2009_index ON partitioning_test_2009(id); -- CREATE INDEX CONCURRENTLY on partition CREATE INDEX CONCURRENTLY partitioned_2010_index ON partitioning_test_2010(id); -- see index is created -SELECT tablename, indexname FROM pg_indexes WHERE tablename LIKE 'partitioning_test%' ORDER BY indexname; +SELECT tablename, indexname FROM pg_indexes WHERE tablename LIKE 'partitioning_test_%' ORDER BY indexname; tablename | indexname ---------------------------+---------------------------------- partitioning_test_2010 | partitioned_2010_index @@ -571,7 +570,7 @@ CREATE TABLE non_distributed_partitioned_table_1 PARTITION OF non_distributed_pa FOR VALUES FROM (0) TO (10); CREATE INDEX non_distributed_partitioned_table_index ON non_distributed_partitioned_table(a); -- see index is created -SELECT tablename, indexname FROM pg_indexes WHERE tablename LIKE 'non_distributed%' ORDER BY indexname; +SELECT tablename, indexname FROM pg_indexes WHERE tablename LIKE 'non_distributed_partitioned_table_%' ORDER BY indexname; tablename | indexname -------------------------------------+------------------------------------------- non_distributed_partitioned_table_1 | non_distributed_partitioned_table_1_a_idx diff --git a/src/test/regress/expected/multi_partitioning_0.out b/src/test/regress/expected/multi_partitioning_0.out index 9eaf20f3a..7ffd8edf0 100644 --- a/src/test/regress/expected/multi_partitioning_0.out +++ b/src/test/regress/expected/multi_partitioning_0.out @@ -4,12 +4,11 @@ SET citus.next_shard_id TO 1660000; SET citus.shard_count TO 4; SET citus.shard_replication_factor TO 1; --- print major version number for version-specific tests SHOW server_version \gset -SELECT substring(:'server_version', '\d+')::int AS server_version; - server_version ----------------- - 10 +SELECT substring(:'server_version', '\d+')::int > 10 AS server_version_above_ten; + server_version_above_ten +-------------------------- + f (1 row) -- @@ -543,7 +542,7 @@ CREATE INDEX partitioning_2009_index ON partitioning_test_2009(id); -- CREATE INDEX CONCURRENTLY on partition CREATE INDEX CONCURRENTLY partitioned_2010_index ON partitioning_test_2010(id); -- see index is created -SELECT tablename, indexname FROM pg_indexes WHERE tablename LIKE 'partitioning_test%' ORDER BY indexname; +SELECT tablename, indexname FROM pg_indexes WHERE tablename LIKE 'partitioning_test_%' ORDER BY indexname; tablename | indexname ------------------------+------------------------- partitioning_test_2010 | partitioned_2010_index @@ -568,7 +567,7 @@ FOR VALUES FROM (0) TO (10); CREATE INDEX non_distributed_partitioned_table_index ON non_distributed_partitioned_table(a); ERROR: cannot create index on partitioned table "non_distributed_partitioned_table" -- see index is created -SELECT tablename, indexname FROM pg_indexes WHERE tablename LIKE 'non_distributed%' ORDER BY indexname; +SELECT tablename, indexname FROM pg_indexes WHERE tablename LIKE 'non_distributed_partitioned_table_%' ORDER BY indexname; tablename | indexname -----------+----------- (0 rows) diff --git a/src/test/regress/expected/multi_partitioning_1.out b/src/test/regress/expected/multi_partitioning_1.out index 72ea95550..a2a423606 100644 --- a/src/test/regress/expected/multi_partitioning_1.out +++ b/src/test/regress/expected/multi_partitioning_1.out @@ -4,12 +4,11 @@ SET citus.next_shard_id TO 1660000; SET citus.shard_count TO 4; SET citus.shard_replication_factor TO 1; --- print major version number for version-specific tests SHOW server_version \gset -SELECT substring(:'server_version', '\d+')::int AS server_version; - server_version ----------------- - 11 +SELECT substring(:'server_version', '\d+')::int > 10 AS server_version_above_ten; + server_version_above_ten +-------------------------- + t (1 row) -- @@ -420,7 +419,7 @@ SELECT * FROM partitioning_test WHERE id = 9 OR id = 10 ORDER BY 1; -- create default partition CREATE TABLE partitioning_test_default PARTITION OF partitioning_test DEFAULT; \d+ partitioning_test - Table "public.partitioning_test" + Partitioned table "public.partitioning_test" Column | Type | Collation | Nullable | Default | Storage | Stats target | Description --------+---------+-----------+----------+---------+---------+--------------+------------- id | integer | | | | plain | | @@ -540,7 +539,7 @@ CREATE INDEX partitioning_2009_index ON partitioning_test_2009(id); -- CREATE INDEX CONCURRENTLY on partition CREATE INDEX CONCURRENTLY partitioned_2010_index ON partitioning_test_2010(id); -- see index is created -SELECT tablename, indexname FROM pg_indexes WHERE tablename LIKE 'partitioning_test%' ORDER BY indexname; +SELECT tablename, indexname FROM pg_indexes WHERE tablename LIKE 'partitioning_test_%' ORDER BY indexname; tablename | indexname ---------------------------+---------------------------------- partitioning_test_2010 | partitioned_2010_index @@ -571,7 +570,7 @@ CREATE TABLE non_distributed_partitioned_table_1 PARTITION OF non_distributed_pa FOR VALUES FROM (0) TO (10); CREATE INDEX non_distributed_partitioned_table_index ON non_distributed_partitioned_table(a); -- see index is created -SELECT tablename, indexname FROM pg_indexes WHERE tablename LIKE 'non_distributed%' ORDER BY indexname; +SELECT tablename, indexname FROM pg_indexes WHERE tablename LIKE 'non_distributed_partitioned_table_%' ORDER BY indexname; tablename | indexname -------------------------------------+------------------------------------------- non_distributed_partitioned_table_1 | non_distributed_partitioned_table_1_a_idx diff --git a/src/test/regress/expected/multi_reference_table.out b/src/test/regress/expected/multi_reference_table.out index cb4bf963e..eb390afed 100644 --- a/src/test/regress/expected/multi_reference_table.out +++ b/src/test/regress/expected/multi_reference_table.out @@ -1382,10 +1382,6 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='reference_sche (0 rows) \c - - - :master_port --- as we expect, setting WITH OIDS does not work for reference tables -ALTER TABLE reference_schema.reference_table_ddl SET WITH OIDS; -ERROR: alter table command is currently unsupported -DETAIL: Only ADD|DROP COLUMN, SET|DROP NOT NULL, SET|DROP DEFAULT, ADD|DROP|VALIDATE CONSTRAINT, SET (), RESET (), ATTACH|DETACH PARTITION and TYPE subcommands are supported. -- now test the renaming of the table, and back to the expected name ALTER TABLE reference_schema.reference_table_ddl RENAME TO reference_table_ddl_test; ALTER TABLE reference_schema.reference_table_ddl_test RENAME TO reference_table_ddl; diff --git a/src/test/regress/expected/multi_subquery_in_where_reference_clause.out b/src/test/regress/expected/multi_subquery_in_where_reference_clause.out index 0531e0dd3..377d651dc 100644 --- a/src/test/regress/expected/multi_subquery_in_where_reference_clause.out +++ b/src/test/regress/expected/multi_subquery_in_where_reference_clause.out @@ -87,7 +87,7 @@ DETAIL: Functions are not allowed in FROM clause when the query has subqueries SELECT user_id FROM - (SELECT 5 AS user_id) users_reference_table + (SELECT 5 AS user_id UNION ALL SELECT 6) users_reference_table WHERE NOT EXISTS (SELECT @@ -99,7 +99,7 @@ WHERE ) LIMIT 3; ERROR: cannot pushdown the subquery -DETAIL: Subqueries without FROM are not allowed in FROM clause when the outer query has subqueries in WHERE clause and it references a column from another query +DETAIL: Complex subqueries and CTEs are not allowed in the FROM clause when the query has subqueries in the WHERE clause and it references a column from another query -- join with distributed table prevents FROM from recurring SELECT DISTINCT user_id diff --git a/src/test/regress/expected/multi_utility_statements.out b/src/test/regress/expected/multi_utility_statements.out index 67e3d5d52..31888483a 100644 --- a/src/test/regress/expected/multi_utility_statements.out +++ b/src/test/regress/expected/multi_utility_statements.out @@ -188,10 +188,9 @@ VIETNAM RUSSIA UNITED KINGDOM UNITED STATES --- Test that we can create on-commit drop tables, and also test creating with --- oids, along with changing column names +-- Test that we can create on-commit drop tables, along with changing column names BEGIN; -CREATE TEMP TABLE customer_few (customer_key) WITH (OIDS) ON COMMIT DROP AS +CREATE TEMP TABLE customer_few (customer_key) ON COMMIT DROP AS (SELECT * FROM customer WHERE c_nationkey = 1 ORDER BY c_custkey LIMIT 10); SELECT customer_key, c_name, c_address FROM customer_few ORDER BY customer_key LIMIT 5; diff --git a/src/test/regress/expected/sql_procedure.out b/src/test/regress/expected/sql_procedure.out index 889af5b8a..c84db5611 100644 --- a/src/test/regress/expected/sql_procedure.out +++ b/src/test/regress/expected/sql_procedure.out @@ -98,7 +98,7 @@ $$; CALL test_procedure_modify_insert(2,12); ERROR: duplicate key value violates unique constraint "idx_table_100503" DETAIL: Key (id, org_id)=(2, 12) already exists. -CONTEXT: while executing command on localhost:57637 +CONTEXT: while executing command on localhost:57638 SQL statement "INSERT INTO test_table VALUES (tt_id, tt_org_id)" PL/pgSQL function test_procedure_modify_insert(integer,integer) line 5 at SQL statement SELECT * FROM test_table ORDER BY 1, 2; @@ -118,7 +118,7 @@ $$; CALL test_procedure_modify_insert_commit(2,30); ERROR: duplicate key value violates unique constraint "idx_table_100503" DETAIL: Key (id, org_id)=(2, 30) already exists. -CONTEXT: while executing command on localhost:57637 +CONTEXT: while executing command on localhost:57638 SQL statement "INSERT INTO test_table VALUES (tt_id, tt_org_id)" PL/pgSQL function test_procedure_modify_insert_commit(integer,integer) line 5 at SQL statement SELECT * FROM test_table ORDER BY 1, 2; @@ -209,14 +209,8 @@ SELECT * from test_table; ----+-------- (0 rows) +\set VERBOSITY terse DROP SCHEMA procedure_schema CASCADE; NOTICE: drop cascades to 8 other objects -DETAIL: drop cascades to table test_table -drop cascades to function test_procedure_delete_insert(integer,integer) -drop cascades to function test_procedure_modify_insert(integer,integer) -drop cascades to function test_procedure_modify_insert_commit(integer,integer) -drop cascades to function test_procedure_rollback_3(integer,integer) -drop cascades to function test_procedure_rollback(integer,integer) -drop cascades to function test_procedure_rollback_2(integer,integer) -drop cascades to function test_procedure(integer,integer) +\set VERBOSITY default RESET SEARCH_PATH; diff --git a/src/test/regress/expected/sql_procedure_0.out b/src/test/regress/expected/sql_procedure_0.out index ef63e9c1b..a8b289a63 100644 --- a/src/test/regress/expected/sql_procedure_0.out +++ b/src/test/regress/expected/sql_procedure_0.out @@ -277,6 +277,8 @@ SELECT * from test_table; ----+-------- (0 rows) +\set VERBOSITY terse DROP SCHEMA procedure_schema CASCADE; NOTICE: drop cascades to table test_table +\set VERBOSITY default RESET SEARCH_PATH; diff --git a/src/test/regress/expected/subquery_in_where.out b/src/test/regress/expected/subquery_in_where.out index ad583faa9..926c3e309 100644 --- a/src/test/regress/expected/subquery_in_where.out +++ b/src/test/regress/expected/subquery_in_where.out @@ -39,17 +39,18 @@ ERROR: cannot pushdown the subquery DETAIL: Complex subqueries and CTEs are not allowed in the FROM clause when the query has subqueries in the WHERE clause and it references a column from another query -- Recurring tuples as empty join tree SELECT * -FROM (SELECT 1 AS id, - 2 AS value_1, - 3 AS value_3) AS tt1 +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); -DEBUG: generating subplan 6_1 for subquery SELECT user_id FROM public.events_table -DEBUG: Plan 6 query after replacing subqueries and CTEs: SELECT id, value_1, value_3 FROM (SELECT 1 AS id, 2 AS value_1, 3 AS value_3) tt1 WHERE (id OPERATOR(pg_catalog.=) ANY (SELECT intermediate_result.user_id FROM read_intermediate_result('6_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer))) +DEBUG: generating subplan 6_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 6_2 for subquery SELECT user_id FROM public.events_table +DEBUG: Plan 6 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('6_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('6_2'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer))) id | value_1 | value_3 ----+---------+--------- 1 | 2 | 3 -(1 row) + 2 | 3 | 4 +(2 rows) -- Recurring tuples in from clause as CTE and SET operation in WHERE clause SELECT Count(*) diff --git a/src/test/regress/sql/failure_multi_dml.sql b/src/test/regress/sql/failure_multi_dml.sql index a317da996..d70e27f2b 100644 --- a/src/test/regress/sql/failure_multi_dml.sql +++ b/src/test/regress/sql/failure_multi_dml.sql @@ -157,7 +157,7 @@ SELECT citus.mitmproxy('conn.onQuery(query="^COMMIT").kill()'); -- hide the error message (it has the PID)... -- we'll test for the txn side-effects to ensure it didn't run -SET client_min_messages TO FATAL; +SET client_min_messages TO ERROR; BEGIN; DELETE FROM dml_test WHERE id = 1; diff --git a/src/test/regress/sql/foreign_key_restriction_enforcement.sql b/src/test/regress/sql/foreign_key_restriction_enforcement.sql index 02dce96b0..1adafed74 100644 --- a/src/test/regress/sql/foreign_key_restriction_enforcement.sql +++ b/src/test/regress/sql/foreign_key_restriction_enforcement.sql @@ -467,6 +467,9 @@ BEGIN; ROLLBACK; -- case 4.5: SELECT to a dist table is follwed by a TRUNCATE +\set VERBOSITY terse +SET client_min_messages to LOG; + BEGIN; SELECT count(*) FROM on_update_fkey_table WHERE value_1 = 99; TRUNCATE reference_table CASCADE; @@ -488,6 +491,9 @@ BEGIN; TRUNCATE transitive_reference_table CASCADE; ROLLBACK; +RESET client_min_messages; +\set VERBOSITY default + -- case 5.1: Parallel UPDATE on distributed table follow by a SELECT BEGIN; UPDATE on_update_fkey_table SET value_1 = 16 WHERE value_1 = 15; @@ -899,6 +905,8 @@ ROLLBACK; RESET client_min_messages; +\set VERBOSITY terse DROP SCHEMA test_fkey_to_ref_in_tx CASCADE; +\set VERBOSITY default SET search_path TO public; diff --git a/src/test/regress/sql/multi_create_shards.sql b/src/test/regress/sql/multi_create_shards.sql index 5e6dde8b9..8e77eeac8 100644 --- a/src/test/regress/sql/multi_create_shards.sql +++ b/src/test/regress/sql/multi_create_shards.sql @@ -51,13 +51,8 @@ CREATE TABLE table_to_distribute ( test_type_data dummy_type ); --- use the table WITH (OIDS) set -ALTER TABLE table_to_distribute SET WITH OIDS; SELECT create_distributed_table('table_to_distribute', 'id', 'hash'); --- revert WITH (OIDS) from above -ALTER TABLE table_to_distribute SET WITHOUT OIDS; - -- use an index instead of table name SELECT create_distributed_table('table_to_distribute_pkey', 'id', 'hash'); diff --git a/src/test/regress/sql/multi_master_protocol.sql b/src/test/regress/sql/multi_master_protocol.sql index 4a56722ee..ce4c65c5d 100644 --- a/src/test/regress/sql/multi_master_protocol.sql +++ b/src/test/regress/sql/multi_master_protocol.sql @@ -10,7 +10,7 @@ SET citus.next_shard_id TO 740000; SELECT part_storage_type, part_key, part_replica_count, part_max_size, part_placement_policy FROM master_get_table_metadata('lineitem'); -SELECT * FROM master_get_table_ddl_events('lineitem'); +SELECT * FROM master_get_table_ddl_events('lineitem') order by 1; SELECT * FROM master_get_new_shardid(); diff --git a/src/test/regress/sql/multi_metadata_sync.sql b/src/test/regress/sql/multi_metadata_sync.sql index c1c608af4..8019395b7 100644 --- a/src/test/regress/sql/multi_metadata_sync.sql +++ b/src/test/regress/sql/multi_metadata_sync.sql @@ -29,7 +29,7 @@ SELECT * FROM pg_dist_partition WHERE partmethod='h' AND repmodel='s'; -- Show that, with no MX tables, metadata snapshot contains only the delete commands, -- pg_dist_node entries and reference tables -SELECT unnest(master_metadata_snapshot()); +SELECT unnest(master_metadata_snapshot()) order by 1; -- Create a test table with constraints and SERIAL CREATE TABLE mx_test_table (col_1 int UNIQUE, col_2 text NOT NULL, col_3 BIGSERIAL); @@ -41,26 +41,26 @@ SELECT master_create_worker_shards('mx_test_table', 8, 1); UPDATE pg_dist_partition SET repmodel='s' WHERE logicalrelid='mx_test_table'::regclass; -- Show that the created MX table is included in the metadata snapshot -SELECT unnest(master_metadata_snapshot()); +SELECT unnest(master_metadata_snapshot()) order by 1; -- Show that CREATE INDEX commands are included in the metadata snapshot CREATE INDEX mx_index ON mx_test_table(col_2); -SELECT unnest(master_metadata_snapshot()); +SELECT unnest(master_metadata_snapshot()) order by 1; -- Show that schema changes are included in the metadata snapshot CREATE SCHEMA mx_testing_schema; ALTER TABLE mx_test_table SET SCHEMA mx_testing_schema; -SELECT unnest(master_metadata_snapshot()); +SELECT unnest(master_metadata_snapshot()) order by 1; -- Show that append distributed tables are not included in the metadata snapshot CREATE TABLE non_mx_test_table (col_1 int, col_2 text); SELECT master_create_distributed_table('non_mx_test_table', 'col_1', 'append'); UPDATE pg_dist_partition SET repmodel='s' WHERE logicalrelid='non_mx_test_table'::regclass; -SELECT unnest(master_metadata_snapshot()); +SELECT unnest(master_metadata_snapshot()) order by 1; -- Show that range distributed tables are not included in the metadata snapshot UPDATE pg_dist_partition SET partmethod='r' WHERE logicalrelid='non_mx_test_table'::regclass; -SELECT unnest(master_metadata_snapshot()); +SELECT unnest(master_metadata_snapshot()) order by 1; -- Test start_metadata_sync_to_node UDF diff --git a/src/test/regress/sql/multi_partitioning.sql b/src/test/regress/sql/multi_partitioning.sql index fbe2ec280..4641ca166 100644 --- a/src/test/regress/sql/multi_partitioning.sql +++ b/src/test/regress/sql/multi_partitioning.sql @@ -6,9 +6,8 @@ SET citus.next_shard_id TO 1660000; SET citus.shard_count TO 4; SET citus.shard_replication_factor TO 1; --- print major version number for version-specific tests SHOW server_version \gset -SELECT substring(:'server_version', '\d+')::int AS server_version; +SELECT substring(:'server_version', '\d+')::int > 10 AS server_version_above_ten; -- -- Distributed Partitioned Table Creation Tests @@ -339,7 +338,7 @@ CREATE INDEX partitioning_2009_index ON partitioning_test_2009(id); CREATE INDEX CONCURRENTLY partitioned_2010_index ON partitioning_test_2010(id); -- see index is created -SELECT tablename, indexname FROM pg_indexes WHERE tablename LIKE 'partitioning_test%' ORDER BY indexname; +SELECT tablename, indexname FROM pg_indexes WHERE tablename LIKE 'partitioning_test_%' ORDER BY indexname; -- test drop -- indexes created on parent table can only be dropped on parent table @@ -360,7 +359,7 @@ FOR VALUES FROM (0) TO (10); CREATE INDEX non_distributed_partitioned_table_index ON non_distributed_partitioned_table(a); -- see index is created -SELECT tablename, indexname FROM pg_indexes WHERE tablename LIKE 'non_distributed%' ORDER BY indexname; +SELECT tablename, indexname FROM pg_indexes WHERE tablename LIKE 'non_distributed_partitioned_table_%' ORDER BY indexname; -- drop the index and see it is dropped DROP INDEX non_distributed_partitioned_table_index; diff --git a/src/test/regress/sql/multi_reference_table.sql b/src/test/regress/sql/multi_reference_table.sql index 767027d2e..bdccc4fc0 100644 --- a/src/test/regress/sql/multi_reference_table.sql +++ b/src/test/regress/sql/multi_reference_table.sql @@ -874,9 +874,6 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='reference_sche \di reference_schema.reference_index_2* \c - - - :master_port --- as we expect, setting WITH OIDS does not work for reference tables -ALTER TABLE reference_schema.reference_table_ddl SET WITH OIDS; - -- now test the renaming of the table, and back to the expected name ALTER TABLE reference_schema.reference_table_ddl RENAME TO reference_table_ddl_test; ALTER TABLE reference_schema.reference_table_ddl_test RENAME TO reference_table_ddl; diff --git a/src/test/regress/sql/multi_subquery_in_where_reference_clause.sql b/src/test/regress/sql/multi_subquery_in_where_reference_clause.sql index 6f9c74650..294cb240d 100644 --- a/src/test/regress/sql/multi_subquery_in_where_reference_clause.sql +++ b/src/test/regress/sql/multi_subquery_in_where_reference_clause.sql @@ -77,7 +77,7 @@ LIMIT 3; SELECT user_id FROM - (SELECT 5 AS user_id) users_reference_table + (SELECT 5 AS user_id UNION ALL SELECT 6) users_reference_table WHERE NOT EXISTS (SELECT diff --git a/src/test/regress/sql/multi_utility_statements.sql b/src/test/regress/sql/multi_utility_statements.sql index 1039dc849..32fb4b8cd 100644 --- a/src/test/regress/sql/multi_utility_statements.sql +++ b/src/test/regress/sql/multi_utility_statements.sql @@ -106,12 +106,11 @@ COPY nation TO STDOUT; -- ensure individual cols can be copied out, too COPY nation(n_name) TO STDOUT; --- Test that we can create on-commit drop tables, and also test creating with --- oids, along with changing column names +-- Test that we can create on-commit drop tables, along with changing column names BEGIN; -CREATE TEMP TABLE customer_few (customer_key) WITH (OIDS) ON COMMIT DROP AS +CREATE TEMP TABLE customer_few (customer_key) ON COMMIT DROP AS (SELECT * FROM customer WHERE c_nationkey = 1 ORDER BY c_custkey LIMIT 10); SELECT customer_key, c_name, c_address diff --git a/src/test/regress/sql/sql_procedure.sql b/src/test/regress/sql/sql_procedure.sql index 4771d78a8..6c665181c 100644 --- a/src/test/regress/sql/sql_procedure.sql +++ b/src/test/regress/sql/sql_procedure.sql @@ -166,6 +166,8 @@ call test_procedure(1,1); call test_procedure(20, 20); SELECT * from test_table; +\set VERBOSITY terse DROP SCHEMA procedure_schema CASCADE; +\set VERBOSITY default RESET SEARCH_PATH; diff --git a/src/test/regress/sql/subquery_in_where.sql b/src/test/regress/sql/subquery_in_where.sql index afcf6fccc..be9b45f0e 100644 --- a/src/test/regress/sql/subquery_in_where.sql +++ b/src/test/regress/sql/subquery_in_where.sql @@ -6,46 +6,45 @@ SET search_path TO subquery_in_where, public; SET client_min_messages TO DEBUG1; ---CTEs can be used as a recurring tuple with subqueries in WHERE +--CTEs can be used as a recurring tuple with subqueries in WHERE WITH event_id - AS (SELECT user_id AS events_user_id, - time AS events_time, + AS (SELECT user_id AS events_user_id, + time AS events_time, event_type - FROM events_table) -SELECT Count(*) + FROM events_table) +SELECT Count(*) FROM event_id WHERE events_user_id IN (SELECT user_id FROM users_table); ---Correlated subqueries can not be used in WHERE clause -WITH event_id - AS (SELECT user_id AS events_user_id, - time AS events_time, - event_type - FROM events_table) -SELECT Count(*) -FROM event_id -WHERE events_user_id IN (SELECT user_id - FROM users_table - WHERE users_table.time = events_time); +--Correlated subqueries can not be used in WHERE clause +WITH event_id + AS (SELECT user_id AS events_user_id, + time AS events_time, + event_type + FROM events_table) +SELECT Count(*) +FROM event_id +WHERE events_user_id IN (SELECT user_id + FROM users_table + WHERE users_table.time = events_time); --- Recurring tuples as empty join tree -SELECT * -FROM (SELECT 1 AS id, - 2 AS value_1, - 3 AS value_3) AS tt1 -WHERE id IN (SELECT user_id - FROM events_table); +-- Recurring tuples as empty join tree +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); -- Recurring tuples in from clause as CTE and SET operation in WHERE clause SELECT Count(*) FROM (WITH event_id AS - (SELECT user_id AS events_user_id, time AS events_time, event_type + (SELECT user_id AS events_user_id, time AS events_time, event_type FROM events_table) SELECT events_user_id, events_time, event_type - FROM event_id + FROM event_id ORDER BY 1,2,3 - LIMIT 10) AS sub_table + LIMIT 10) AS sub_table WHERE events_user_id IN ( (SELECT user_id FROM users_table @@ -157,7 +156,7 @@ FROM user_id as events_user_id, time as events_time, event_type FROM events_table - ORDER BY + ORDER BY 1,2,3 LIMIT 10 @@ -499,7 +498,7 @@ FROM users_table ORDER BY user_id - LIMIT + LIMIT 10) as sub_table WHERE user_id