mirror of https://github.com/citusdata/citus.git
Fix psql-dependent constraint tests
Added a new view for fkeys and removed any \d commands which displayed tables.pull/1439/head
parent
05ba20f78c
commit
ad97e8d8f4
|
@ -401,80 +401,19 @@ SELECT master_create_worker_shards('check_example', '2', '2');
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
\c - - - :worker_1_port
|
\c - - - :worker_1_port
|
||||||
\d check_example*
|
\d check_example_partition_col_key_365040
|
||||||
Table "public.check_example_365040"
|
|
||||||
Column | Type | Modifiers
|
|
||||||
-----------------+---------+-----------
|
|
||||||
partition_col | integer |
|
|
||||||
other_col | integer |
|
|
||||||
other_other_col | integer |
|
|
||||||
Indexes:
|
|
||||||
"check_example_partition_col_key_365040" UNIQUE CONSTRAINT, btree (partition_col)
|
|
||||||
Check constraints:
|
|
||||||
"check_example_other_col_check" CHECK (other_col >= 100)
|
|
||||||
"check_example_other_other_col_check" CHECK (abs(other_other_col) >= 100)
|
|
||||||
|
|
||||||
Table "public.check_example_365041"
|
|
||||||
Column | Type | Modifiers
|
|
||||||
-----------------+---------+-----------
|
|
||||||
partition_col | integer |
|
|
||||||
other_col | integer |
|
|
||||||
other_other_col | integer |
|
|
||||||
Indexes:
|
|
||||||
"check_example_partition_col_key_365041" UNIQUE CONSTRAINT, btree (partition_col)
|
|
||||||
Check constraints:
|
|
||||||
"check_example_other_col_check" CHECK (other_col >= 100)
|
|
||||||
"check_example_other_other_col_check" CHECK (abs(other_other_col) >= 100)
|
|
||||||
|
|
||||||
Index "public.check_example_partition_col_key_365040"
|
Index "public.check_example_partition_col_key_365040"
|
||||||
Column | Type | Definition
|
Column | Type | Definition
|
||||||
---------------+---------+---------------
|
---------------+---------+---------------
|
||||||
partition_col | integer | partition_col
|
partition_col | integer | partition_col
|
||||||
unique, btree, for table "public.check_example_365040"
|
unique, btree, for table "public.check_example_365040"
|
||||||
|
|
||||||
Index "public.check_example_partition_col_key_365041"
|
SELECT "Constraint", "Definition" FROM table_checks WHERE relid='public.check_example_365040'::regclass;
|
||||||
Column | Type | Definition
|
Constraint | Definition
|
||||||
---------------+---------+---------------
|
-------------------------------------+-------------------------------------
|
||||||
partition_col | integer | partition_col
|
check_example_other_col_check | CHECK (other_col >= 100)
|
||||||
unique, btree, for table "public.check_example_365041"
|
check_example_other_other_col_check | CHECK (abs(other_other_col) >= 100)
|
||||||
|
(2 rows)
|
||||||
\c - - - :worker_2_port
|
|
||||||
\d check_example*
|
|
||||||
Table "public.check_example_365040"
|
|
||||||
Column | Type | Modifiers
|
|
||||||
-----------------+---------+-----------
|
|
||||||
partition_col | integer |
|
|
||||||
other_col | integer |
|
|
||||||
other_other_col | integer |
|
|
||||||
Indexes:
|
|
||||||
"check_example_partition_col_key_365040" UNIQUE CONSTRAINT, btree (partition_col)
|
|
||||||
Check constraints:
|
|
||||||
"check_example_other_col_check" CHECK (other_col >= 100)
|
|
||||||
"check_example_other_other_col_check" CHECK (abs(other_other_col) >= 100)
|
|
||||||
|
|
||||||
Table "public.check_example_365041"
|
|
||||||
Column | Type | Modifiers
|
|
||||||
-----------------+---------+-----------
|
|
||||||
partition_col | integer |
|
|
||||||
other_col | integer |
|
|
||||||
other_other_col | integer |
|
|
||||||
Indexes:
|
|
||||||
"check_example_partition_col_key_365041" UNIQUE CONSTRAINT, btree (partition_col)
|
|
||||||
Check constraints:
|
|
||||||
"check_example_other_col_check" CHECK (other_col >= 100)
|
|
||||||
"check_example_other_other_col_check" CHECK (abs(other_other_col) >= 100)
|
|
||||||
|
|
||||||
Index "public.check_example_partition_col_key_365040"
|
|
||||||
Column | Type | Definition
|
|
||||||
---------------+---------+---------------
|
|
||||||
partition_col | integer | partition_col
|
|
||||||
unique, btree, for table "public.check_example_365040"
|
|
||||||
|
|
||||||
Index "public.check_example_partition_col_key_365041"
|
|
||||||
Column | Type | Definition
|
|
||||||
---------------+---------+---------------
|
|
||||||
partition_col | integer | partition_col
|
|
||||||
unique, btree, for table "public.check_example_365041"
|
|
||||||
|
|
||||||
\c - - - :master_port
|
\c - - - :master_port
|
||||||
-- drop unnecessary tables
|
-- drop unnecessary tables
|
||||||
|
@ -501,15 +440,11 @@ SELECT create_distributed_table('raw_table_2', 'user_id');
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- see that the constraint exists
|
-- see that the constraint exists
|
||||||
\d raw_table_2
|
SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='raw_table_2'::regclass;
|
||||||
Table "public.raw_table_2"
|
Constraint | Definition
|
||||||
Column | Type | Modifiers
|
--------------------------+-------------------------------------------------------
|
||||||
---------+---------+-----------
|
raw_table_2_user_id_fkey | FOREIGN KEY (user_id) REFERENCES raw_table_1(user_id)
|
||||||
user_id | integer |
|
(1 row)
|
||||||
Indexes:
|
|
||||||
"raw_table_2_user_id_key" UNIQUE CONSTRAINT, btree (user_id)
|
|
||||||
Foreign-key constraints:
|
|
||||||
"raw_table_2_user_id_fkey" FOREIGN KEY (user_id) REFERENCES raw_table_1(user_id)
|
|
||||||
|
|
||||||
-- should be prevented by the foreign key
|
-- should be prevented by the foreign key
|
||||||
DROP TABLE raw_table_1;
|
DROP TABLE raw_table_1;
|
||||||
|
@ -520,13 +455,10 @@ HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
||||||
DROP TABLE raw_table_1 CASCADE;
|
DROP TABLE raw_table_1 CASCADE;
|
||||||
NOTICE: drop cascades to constraint raw_table_2_user_id_fkey on table raw_table_2
|
NOTICE: drop cascades to constraint raw_table_2_user_id_fkey on table raw_table_2
|
||||||
-- see that the constraint also dropped
|
-- see that the constraint also dropped
|
||||||
\d raw_table_2
|
SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='raw_table_2'::regclass;
|
||||||
Table "public.raw_table_2"
|
Constraint | Definition
|
||||||
Column | Type | Modifiers
|
------------+------------
|
||||||
---------+---------+-----------
|
(0 rows)
|
||||||
user_id | integer |
|
|
||||||
Indexes:
|
|
||||||
"raw_table_2_user_id_key" UNIQUE CONSTRAINT, btree (user_id)
|
|
||||||
|
|
||||||
-- drop the table as well
|
-- drop the table as well
|
||||||
DROP TABLE raw_table_2;
|
DROP TABLE raw_table_2;
|
||||||
|
|
|
@ -237,9 +237,8 @@ SELECT master_create_distributed_table('check_example', 'partition_col', 'hash')
|
||||||
SELECT master_create_worker_shards('check_example', '2', '2');
|
SELECT master_create_worker_shards('check_example', '2', '2');
|
||||||
|
|
||||||
\c - - - :worker_1_port
|
\c - - - :worker_1_port
|
||||||
\d check_example*
|
\d check_example_partition_col_key_365040
|
||||||
\c - - - :worker_2_port
|
SELECT "Constraint", "Definition" FROM table_checks WHERE relid='public.check_example_365040'::regclass;
|
||||||
\d check_example*
|
|
||||||
\c - - - :master_port
|
\c - - - :master_port
|
||||||
|
|
||||||
-- drop unnecessary tables
|
-- drop unnecessary tables
|
||||||
|
@ -260,7 +259,7 @@ CREATE TABLE raw_table_2 (user_id int REFERENCES raw_table_1(user_id), UNIQUE(us
|
||||||
SELECT create_distributed_table('raw_table_2', 'user_id');
|
SELECT create_distributed_table('raw_table_2', 'user_id');
|
||||||
|
|
||||||
-- see that the constraint exists
|
-- see that the constraint exists
|
||||||
\d raw_table_2
|
SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='raw_table_2'::regclass;
|
||||||
|
|
||||||
-- should be prevented by the foreign key
|
-- should be prevented by the foreign key
|
||||||
DROP TABLE raw_table_1;
|
DROP TABLE raw_table_1;
|
||||||
|
@ -269,7 +268,7 @@ DROP TABLE raw_table_1;
|
||||||
DROP TABLE raw_table_1 CASCADE;
|
DROP TABLE raw_table_1 CASCADE;
|
||||||
|
|
||||||
-- see that the constraint also dropped
|
-- see that the constraint also dropped
|
||||||
\d raw_table_2
|
SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='raw_table_2'::regclass;
|
||||||
|
|
||||||
-- drop the table as well
|
-- drop the table as well
|
||||||
DROP TABLE raw_table_2;
|
DROP TABLE raw_table_2;
|
||||||
|
|
Loading…
Reference in New Issue