Add test case for Issue #57
authorPallavi Sontakke <[email protected]>
Thu, 28 Jul 2016 07:59:48 +0000 (13:29 +0530)
committerPallavi Sontakke <[email protected]>
Thu, 28 Jul 2016 07:59:48 +0000 (13:29 +0530)
When distribution column is changed for a table, we don't check for dependecies such as UNIQUE indexes

src/test/regress/expected/xl_reported_bugs.out
src/test/regress/sql/xl_reported_bugs.sql

index d48802d6c9181614e0ea9662fe5f3788f7f830dc..3a6470805ecc0bbb50dcf37fa668c17d2d067e86 100644 (file)
@@ -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 (
index 986c0a860af1b3c872a9da6db1ccec517f99ad0a..9abefad8e6bb277d2fede9b2d04c4d331e2780f1 100644 (file)
@@ -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 (