yugabyte / yugabyte-db

YugabyteDB - the cloud native distributed SQL database for mission-critical applications.
https://www.yugabyte.com
Other
9.02k stars 1.08k forks source link

[YSQL] Indexes, Primary key and Unique constraints on various datatypes are not supported #25003

Open priyanshi-yb opened 1 day ago

priyanshi-yb commented 1 day ago

Jira Link: DB-14147

Description

Currently YugabyteDB doesn't support the Indexes, Primary key and Unique constraints on the various datatypes as mentioned on this docs including few more mentioned below-

yugabyte=# create  table test_types(id int, t tsrange, d daterange, tz tstzrange, n numrange, i4 int4range, i8 int8range, s smallint, inym INTERVAL YEAR TO MONTH, inds INTERVAL DAY TO SECOND(6));
CREATE TABLE
yugabyte=# create index i1 on test_types(t);
ERROR:  INDEX on column of type 'user_defined_type' not yet supported
yugabyte=# create index i1 on test_types(d);
ERROR:  INDEX on column of type 'user_defined_type' not yet supported
yugabyte=# create index i1 on test_types(tz);
ERROR:  INDEX on column of type 'user_defined_type' not yet supported
...
yugabyte=# ALTER TABLE test_types ADD CONSTRAINT uk UNIQUE(d);
ERROR:  INDEX on column of type 'user_defined_type' not yet supported
yugabyte=# ALTER TABLE test_types ADD CONSTRAINT pk PRIMARY KEY(d);
NOTICE:  table rewrite may lead to inconsistencies
DETAIL:  Concurrent DMLs may not be reflected in the new table.
HINT:  See https://github.com/yugabyte/yugabyte-db/issues/19860. Set 'ysql_suppress_unsafe_alter_notice' yb-tserver gflag to true to suppress this notice.
ERROR:  PRIMARY KEY containing column of type 'user_defined_type' not yet supported

Issue Type

kind/new-feature

Warning: Please confirm that this issue does not contain any sensitive information