drop domain tests

pull/5692/head
Onur Tirtir 2022-03-09 19:00:26 +03:00
parent 6fa965cd17
commit 4a4ce7114a
2 changed files with 0 additions and 123 deletions

View File

@ -46,75 +46,5 @@ SELECT * FROM arr_subs_update ORDER BY 1,2,3,4;
2 | {4,5,6} | bar | 70 2 | {4,5,6} | bar | 70
(2 rows) (2 rows)
CREATE DOMAIN single_int_dom AS int[] CHECK (VALUE[1] != 0);
CREATE DOMAIN dummy_dom AS single_int_dom CHECK (VALUE[2] != 5);
-- Citus doesn't propagate DOMAIN objects
SELECT run_command_on_workers(
$$
CREATE DOMAIN subscripting_op.single_int_dom AS INT[] CHECK (VALUE[1] != 0);
CREATE DOMAIN subscripting_op.dummy_dom AS subscripting_op.single_int_dom CHECK (VALUE[2] != 5);
$$);
run_command_on_workers
---------------------------------------------------------------------
(localhost,57637,t,"CREATE DOMAIN")
(localhost,57638,t,"CREATE DOMAIN")
(2 rows)
CREATE TABLE dummy_dom_test (id int, dummy_dom_col dummy_dom);
SELECT create_distributed_table('dummy_dom_test', 'id');
create_distributed_table
---------------------------------------------------------------------
(1 row)
INSERT INTO dummy_dom_test VALUES (1, '{1,2,3}'), (2, '{6,7,8}');
UPDATE dummy_dom_test
SET dummy_dom_col[2] = 50,
dummy_dom_col[1] = 60;
SELECT * FROM dummy_dom_test ORDER BY 1,2;
id | dummy_dom_col
---------------------------------------------------------------------
1 | {60,50,3}
2 | {60,50,8}
(2 rows)
CREATE TYPE two_ints as (if1 int, if2 int[]);
CREATE DOMAIN two_ints_dom AS two_ints CHECK ((VALUE).if1 > 0);
-- Citus doesn't propagate DOMAIN objects
SELECT run_command_on_workers(
$$
CREATE DOMAIN subscripting_op.two_ints_dom AS subscripting_op.two_ints CHECK ((VALUE).if1 > 0);
$$);
run_command_on_workers
---------------------------------------------------------------------
(localhost,57637,t,"CREATE DOMAIN")
(localhost,57638,t,"CREATE DOMAIN")
(2 rows)
CREATE TABLE two_ints_dom_indirection_test (id int, two_ints_dom_col two_ints_dom);
SELECT create_distributed_table('two_ints_dom_indirection_test', 'id');
create_distributed_table
---------------------------------------------------------------------
(1 row)
INSERT INTO two_ints_dom_indirection_test VALUES (1, '(5, "{1,2,3}")'), (2, '(50, "{10,20,30}")');
-- Citus planner already doesn't allow doing field indirection (e.g.:
-- insert/update <composite type>.<field>) and we have an extra guard against
-- that in deparser for future implementations; so here we test that by using
-- deparse_shard_query_test() as well.
-- i) planner would throw an error
UPDATE two_ints_dom_indirection_test
SET two_ints_dom_col.if2[1] = 50,
two_ints_dom_col.if2[3] = 60;
ERROR: inserting or modifying composite type fields is not supported
-- ii) deparser would throw an error
SELECT public.deparse_shard_query_test(
$$
UPDATE two_ints_dom_indirection_test
SET two_ints_dom_col.if2[1] = 50,
two_ints_dom_col.if2[3] = 60;
$$);
ERROR: unexpectedly got FieldStore object when generating shard query
SET client_min_messages TO WARNING; SET client_min_messages TO WARNING;
DROP SCHEMA subscripting_op CASCADE; DROP SCHEMA subscripting_op CASCADE;

View File

@ -40,58 +40,5 @@ DO UPDATE SET arr[0]=100, arr[1]=200, arr[5]=500;
SELECT * FROM arr_subs_update ORDER BY 1,2,3,4; SELECT * FROM arr_subs_update ORDER BY 1,2,3,4;
CREATE DOMAIN single_int_dom AS int[] CHECK (VALUE[1] != 0);
CREATE DOMAIN dummy_dom AS single_int_dom CHECK (VALUE[2] != 5);
-- Citus doesn't propagate DOMAIN objects
SELECT run_command_on_workers(
$$
CREATE DOMAIN subscripting_op.single_int_dom AS INT[] CHECK (VALUE[1] != 0);
CREATE DOMAIN subscripting_op.dummy_dom AS subscripting_op.single_int_dom CHECK (VALUE[2] != 5);
$$);
CREATE TABLE dummy_dom_test (id int, dummy_dom_col dummy_dom);
SELECT create_distributed_table('dummy_dom_test', 'id');
INSERT INTO dummy_dom_test VALUES (1, '{1,2,3}'), (2, '{6,7,8}');
UPDATE dummy_dom_test
SET dummy_dom_col[2] = 50,
dummy_dom_col[1] = 60;
SELECT * FROM dummy_dom_test ORDER BY 1,2;
CREATE TYPE two_ints as (if1 int, if2 int[]);
CREATE DOMAIN two_ints_dom AS two_ints CHECK ((VALUE).if1 > 0);
-- Citus doesn't propagate DOMAIN objects
SELECT run_command_on_workers(
$$
CREATE DOMAIN subscripting_op.two_ints_dom AS subscripting_op.two_ints CHECK ((VALUE).if1 > 0);
$$);
CREATE TABLE two_ints_dom_indirection_test (id int, two_ints_dom_col two_ints_dom);
SELECT create_distributed_table('two_ints_dom_indirection_test', 'id');
INSERT INTO two_ints_dom_indirection_test VALUES (1, '(5, "{1,2,3}")'), (2, '(50, "{10,20,30}")');
-- Citus planner already doesn't allow doing field indirection (e.g.:
-- insert/update <composite type>.<field>) and we have an extra guard against
-- that in deparser for future implementations; so here we test that by using
-- deparse_shard_query_test() as well.
-- i) planner would throw an error
UPDATE two_ints_dom_indirection_test
SET two_ints_dom_col.if2[1] = 50,
two_ints_dom_col.if2[3] = 60;
-- ii) deparser would throw an error
SELECT public.deparse_shard_query_test(
$$
UPDATE two_ints_dom_indirection_test
SET two_ints_dom_col.if2[1] = 50,
two_ints_dom_col.if2[3] = 60;
$$);
SET client_min_messages TO WARNING; SET client_min_messages TO WARNING;
DROP SCHEMA subscripting_op CASCADE; DROP SCHEMA subscripting_op CASCADE;