+-- #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 (
+-- #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 (