From: Pallavi Sontakke Date: Thu, 28 Jul 2016 07:59:48 +0000 (+0530) Subject: Add test case for Issue #57 X-Git-Tag: XL9_5_R1_3~11 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=d77ce5aecf3c2450277d9cd1ef2f383acaa40ed1;p=postgres-xl.git Add test case for Issue #57 When distribution column is changed for a table, we don't check for dependecies such as UNIQUE indexes --- diff --git a/src/test/regress/expected/xl_reported_bugs.out b/src/test/regress/expected/xl_reported_bugs.out index d48802d6c9..3a6470805e 100644 --- a/src/test/regress/expected/xl_reported_bugs.out +++ b/src/test/regress/expected/xl_reported_bugs.out @@ -1,3 +1,46 @@ +-- #57 +-- When distribution column is changed for a table, we don't check for dependecies such as UNIQUE indexes +CREATE TABLE xl_atm ( + product_no INT8, + product_id INT2, + primary key (product_id) +) DISTRIBUTE BY HASH (product_no); +ERROR: Unique index of partitioned table must contain the hash distribution column. +CREATE TABLE xl_atm ( + product_no INT8, + product_id INT2, + primary key (product_id) +) DISTRIBUTE BY HASH (product_id); +\d+ xl_atm; + Table "public.xl_atm" + Column | Type | Modifiers | Storage | Stats target | Description +------------+----------+-----------+---------+--------------+------------- + product_no | bigint | | plain | | + product_id | smallint | not null | plain | | +Indexes: + "xl_atm_pkey" PRIMARY KEY, btree (product_id) +Distribute By: HASH(product_id) +Location Nodes: ALL DATANODES + +INSERT into xl_atm VALUES (11,1); +INSERT into xl_atm VALUES (12,2); +INSERT into xl_atm VALUES (13,3); +INSERT into xl_atm VALUES (14,4); +INSERT into xl_atm VALUES (11,5);--repeate a value in non-distribution column +ALTER TABLE xl_atm DISTRIBUTE BY HASH (product_no); +ERROR: Unique index of partitioned table must contain the hash distribution column. +\d+ xl_atm; + Table "public.xl_atm" + Column | Type | Modifiers | Storage | Stats target | Description +------------+----------+-----------+---------+--------------+------------- + product_no | bigint | | plain | | + product_id | smallint | not null | plain | | +Indexes: + "xl_atm_pkey" PRIMARY KEY, btree (product_id) +Distribute By: HASH(product_no) +Location Nodes: ALL DATANODES + +DROP TABLE xl_atm; -- #27 -- Distribution column can be dropped for MODULO distribution tables. CREATE TABLE xl_at2m ( diff --git a/src/test/regress/sql/xl_reported_bugs.sql b/src/test/regress/sql/xl_reported_bugs.sql index 986c0a860a..9abefad8e6 100644 --- a/src/test/regress/sql/xl_reported_bugs.sql +++ b/src/test/regress/sql/xl_reported_bugs.sql @@ -1,3 +1,24 @@ +-- #57 +-- When distribution column is changed for a table, we don't check for dependecies such as UNIQUE indexes +CREATE TABLE xl_atm ( + product_no INT8, + product_id INT2, + primary key (product_id) +) DISTRIBUTE BY HASH (product_no); +CREATE TABLE xl_atm ( + product_no INT8, + product_id INT2, + primary key (product_id) +) DISTRIBUTE BY HASH (product_id); +\d+ xl_atm; +INSERT into xl_atm VALUES (11,1); +INSERT into xl_atm VALUES (12,2); +INSERT into xl_atm VALUES (13,3); +INSERT into xl_atm VALUES (14,4); +INSERT into xl_atm VALUES (11,5);--repeate a value in non-distribution column +ALTER TABLE xl_atm DISTRIBUTE BY HASH (product_no); +\d+ xl_atm; +DROP TABLE xl_atm; -- #27 -- Distribution column can be dropped for MODULO distribution tables. CREATE TABLE xl_at2m (