CREATE SCHEMA alter2;
ALTER TABLE IF EXISTS tt8 ADD COLUMN f int;
ALTER TABLE IF EXISTS tt8 ADD CONSTRAINT xxx PRIMARY KEY(f);
-ERROR: Unique index of partitioned table must contain the hash distribution column.
+ERROR: Unique index of distributed table must contain the hash distribution column.
ALTER TABLE IF EXISTS tt8 ADD CHECK (f BETWEEN 0 AND 10);
ALTER TABLE IF EXISTS tt8 ALTER COLUMN f SET DEFAULT 0;
ALTER TABLE IF EXISTS tt8 RENAME COLUMN f TO f1;
--
CREATE TABLE func_index_heap (f1 text, f2 text);
CREATE UNIQUE INDEX func_index_index on func_index_heap (textcat(f1,f2));
-ERROR: Unique index of partitioned table must contain the hash/modulo distribution column.
+ERROR: Unique index of distributed table must contain the hash/modulo distribution column.
INSERT INTO func_index_heap VALUES('ABC','DEF');
INSERT INTO func_index_heap VALUES('AB','CDEFG');
INSERT INTO func_index_heap VALUES('QWE','RTY');
DROP TABLE func_index_heap;
CREATE TABLE func_index_heap (f1 text, f2 text);
CREATE UNIQUE INDEX func_index_index on func_index_heap ((f1 || f2) text_ops);
-ERROR: Unique index of partitioned table must contain the hash/modulo distribution column.
+ERROR: Unique index of distributed table must contain the hash/modulo distribution column.
INSERT INTO func_index_heap VALUES('ABC','DEF');
INSERT INTO func_index_heap VALUES('AB','CDEFG');
INSERT INTO func_index_heap VALUES('QWE','RTY');
DROP INDEX onek_nulltest;
-- Check initial-positioning logic too
CREATE UNIQUE INDEX onek_nulltest ON onek_with_null (unique2);
-ERROR: Unique index of partitioned table must contain the hash/modulo distribution column.
+ERROR: Unique index of distributed table must contain the hash/modulo distribution column.
SET enable_seqscan = OFF;
SET enable_indexscan = ON;
SET enable_bitmapscan = OFF;
(8 rows)
create unique index ec1_expr1 on ec1((ff + 1));
-ERROR: Unique index of partitioned table must contain the hash/modulo distribution column.
+ERROR: Unique index of distributed table must contain the hash/modulo distribution column.
create unique index ec1_expr2 on ec1((ff + 2 + 1));
-ERROR: Unique index of partitioned table must contain the hash/modulo distribution column.
+ERROR: Unique index of distributed table must contain the hash/modulo distribution column.
create unique index ec1_expr3 on ec1((ff + 3 + 1));
-ERROR: Unique index of partitioned table must contain the hash/modulo distribution column.
+ERROR: Unique index of distributed table must contain the hash/modulo distribution column.
create unique index ec1_expr4 on ec1((ff + 4));
-ERROR: Unique index of partitioned table must contain the hash/modulo distribution column.
+ERROR: Unique index of distributed table must contain the hash/modulo distribution column.
explain (costs off)
select * from ec1,
(select ff + 1 as x from
-- In XL, table is distributed by HASH( key ) by default.
-- unique index contains fruit and not key, so this fails.
create unique index cross_match on insertconflicttest(lower(fruit) collate "C", upper(fruit) text_pattern_ops);
-ERROR: Unique index of partitioned table must contain the hash/modulo distribution column.
+ERROR: Unique index of distributed table must contain the hash/modulo distribution column.
-- fails:
explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (lower(fruit) text_pattern_ops, upper(fruit) collate "C") do nothing;
ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification
-- Expression index tests
--
create unique index expr_key_index on insertconflicttest(lower(fruit));
-ERROR: Unique index of partitioned table must contain the hash/modulo distribution column.
+ERROR: Unique index of distributed table must contain the hash/modulo distribution column.
-- inference succeeds:
insert into insertconflicttest values (20, 'Quince') on conflict (lower(fruit)) do update set fruit = excluded.fruit;
ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification
--
create unique index key_index on insertconflicttest(key);
create unique index fruit_index on insertconflicttest(fruit);
-ERROR: Unique index of partitioned table must contain the hash/modulo distribution column.
+ERROR: Unique index of distributed table must contain the hash/modulo distribution column.
-- succeeds, since UPDATE happens to update "fruit" to existing value:
insert into insertconflicttest values (26, 'Fig') on conflict (key) do update set fruit = excluded.fruit;
-- fails, since UPDATE is to row with key value 26, and we're updating "fruit"
CREATE TABLE xl_pk_products ( product_no integer, product_uid integer, name text, price numeric, primary key (product_uid, product_no) ) DISTRIBUTE BY HASH(product_no);
CREATE TABLE xl_pk_products1 ( product_no integer, product_uid integer, name text, price numeric, primary key (product_uid, product_no) ) DISTRIBUTE BY HASH(product_uid);
CREATE TABLE xl_pk_products2 ( product_no integer, product_uid integer, name text, price numeric, primary key (product_uid) ) DISTRIBUTE BY HASH(product_no);
-ERROR: Unique index of partitioned table must contain the hash distribution column.
+ERROR: Unique index of distributed table must contain the hash distribution column.
CREATE TABLE xl_pk_products3 ( product_no integer, product_uid integer, name text, price numeric, primary key (product_no, product_uid) ) DISTRIBUTE BY MODULO(product_no);
CREATE TABLE xl_pk_products4 ( product_no integer, product_uid integer, name text, price numeric, primary key (product_uid, product_no) ) DISTRIBUTE BY MODULO(product_no);
CREATE TABLE xl_pk_products5 ( product_no integer, product_uid integer, name text, price numeric, primary key (product_uid) ) DISTRIBUTE BY MODULO(product_no);
-ERROR: Unique index of partitioned table must contain the hash distribution column.
+ERROR: Unique index of distributed table must contain the hash distribution column.
--For roundrobin distributed table, PRIMARY KEY or UNIQUE INDEX is not supported
CREATE TABLE xl_pk_products6 ( product_no integer, product_uid integer, name text, price numeric, primary key (product_uid) ) DISTRIBUTE BY ROUNDROBIN;
ERROR: Cannot locally enforce a unique index on round robin distributed table.