Add more tests

velioglu/cyclic_dep_2
Burak Velioglu 2022-03-08 19:16:35 +03:00
parent 1a5f95ef9a
commit f52fdac198
No known key found for this signature in database
GPG Key ID: F6827E620F6549C6
2 changed files with 25 additions and 0 deletions

View File

@ -329,6 +329,12 @@ SELECT create_distributed_table('immediate_table', 'a');
SHOW citus.multi_shard_modify_mode;
COMMIT;
-- Show that PG does not allow adding a circular dependency btw types
-- We added here to make sure we can catch it if PG changes it's behaviour
CREATE TYPE circ_type1 AS (a int);
CREATE TYPE circ_type2 AS (a int, b circ_type1);
ALTER TYPE circ_type1 ADD ATTRIBUTE b circ_type2;
-- clear objects
SET client_min_messages TO error; -- suppress cascading objects dropping
DROP SCHEMA type_tests CASCADE;

View File

@ -813,6 +813,25 @@ $$;
-- It should error out due to circular dependency
ALTER TABLE table_1_for_circ_dep_2 ADD CONSTRAINT check_const_for_circ check (func_2_for_circ_dep_2(col_1, NULL::table_2_for_circ_dep_2));
-- Show that causing circular dependency via functions and create_distributed_table are not allowed
CREATE TABLE table_1_for_circ_dep_3(id int, col_1 int);
CREATE OR REPLACE FUNCTION func_for_circ_dep_3(param_1 int, param_2 table_1_for_circ_dep_3)
RETURNS boolean
LANGUAGE plpgsql AS
$$
BEGIN
return param_1 > 5;
END;
$$;
CREATE TABLE table_2_for_circ_dep_3(id int, col_1 int check (func_for_circ_dep_3(col_1, NULL::table_1_for_circ_dep_3)));
ALTER TABLE table_1_for_circ_dep_3 ADD COLUMN col_2 table_2_for_circ_dep_3;
-- It should error out due to circular dependency
SELECT create_distributed_table('table_1_for_circ_dep_3','id');
RESET search_path;
SET client_min_messages TO WARNING;
DROP SCHEMA function_propagation_schema CASCADE;