yugabyte / yugabyte-db

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

[YSQL] Improve error message when split clause fails on hash-partitioned index #16213

Closed kripasreenivasan closed 1 year ago

kripasreenivasan commented 1 year ago

Jira Link: DB-5642

Description

The error when specifying SPLIT AT VALUES clause on a hash-partitioned index can be improved

cl_db_001=# create index ind10 on table_1(id) SPLIT AT VALUES ((100));
ERROR:  SPLIT AT option is not yet supported for hash partitioned tables
cl_db_001=# \d+ table_1
                                                              Table "public.table_1"
    Column     |            Type             | Collation  | Nullable |               Default               | Storage  | Stats target | Description
---------------+-----------------------------+------------+----------+-------------------------------------+----------+--------------+-------------
 id            | text                        |            | not null |                                     | extended |              |
 uuid_col      | uuid                        |            |          | uuid_generate_v4()                  | plain    |              |
 name          | text                        | en_US.utf8 |          |                                     | extended |              |
 c             | complex                     |            |          |                                     | extended |              |
 info          | json                        |            |          |                                     | extended |              |
 contact       | jsonb                       |            |          |                                     | extended |              |
 arr           | smallint[]                  |            |          |                                     | extended |              |
 cash          | money                       |            |          |                                     | plain    |              |
 i             | inet                        |            |          |                                     | main     |              |
 m             | macaddr                     |            |          |                                     | plain    |              |
 i2            | integer                     |            | not null | nextval('table_1_i2_seq'::regclass) | plain    |              |
 i3            | bigint                      |            | not null | nextval('table_1_i3_seq'::regclass) | plain    |              |
 val           | smallint                    |            |          |                                     | plain    |              |
 details       | e_details                   |            |          |                                     | plain    |              |
 age           | integer                     |            |          |                                     | plain    |              |
 collated_data | text                        | POSIX      |          |                                     | extended |              |
 date          | date                        |            |          |                                     | plain    |              |
 n             | numeric(3,2)                |            |          |                                     | main     |              |
 r             | real                        |            |          |                                     | plain    |              |
 c1            | character(1)                |            |          |                                     | extended |              |
 created_at    | timestamp with time zone    |            |          |                                     | plain    |              |
 uuid0         | uuid                        |            |          | uuid_nil()                          | plain    |              |
 uuid1         | uuid                        |            |          | uuid_generate_v1()                  | plain    |              |
 p1            | point                       |            |          |                                     | plain    |              |
 t1            | time without time zone      |            |          |                                     | plain    |              |
 ts1           | timestamp without time zone |            |          |                                     | plain    |              |
 i4            | interval                    |            |          |                                     | plain    |              |
 p2            | path                        |            |          |                                     | extended |              |
 p3            | polygon                     |            |          |                                     | extended |              |
 b             | box                         |            |          |                                     | plain    |              |
 c2            | circle                      |            |          |                                     | plain    |              |
 l             | line                        |            |          |                                     | plain    |              |
 l1            | lseg                        |            |          |                                     | plain    |              |
 a2            | text[]                      |            |          |                                     | extended |              |
 zip           | postal_code                 |            |          |                                     | extended |              |
Indexes:
    "table_1_pkey" PRIMARY KEY, lsm (id HASH)
Options: colocation=false
yifanguan commented 1 year ago

"table_1_pkey" PRIMARY KEY, lsm (id HASH) table_1 is hash-partitioned.

yifanguan commented 1 year ago

One improvement we can do is to let the error message more friendly. In this case, output ERROR: SPLIT AT option is not yet supported for hash partitioned indexes instead of ERROR: SPLIT AT option is not yet supported for hash partitioned tables

sidjha1 commented 1 year ago

Issue resolved by commit 1bf0dab