cockroachdb / cockroachdb/docs

Clarify that FROM is inclusive and TO is exclusive in range partitioning

Open
#23,454 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
212
Forks
476
Avg merge
40m
Merged PRs (30d)
3

Description

On the "Define a range partition on an index" section, it's not documented whether the `FROM` and `TO` bounds in `PARTITION ... VALUES FROM (...) TO (...)` are inclusive or exclusive.

For example:
```sql
ALTER TABLE mq PARTITION BY RANGE (bucket) (
PARTITION mq_0 VALUES FROM (0) TO (86),
PARTITION mq_1 VALUES FROM (86) TO (173),
PARTITION mq_2 VALUES FROM (173) TO (256)
);
```

Since adjacent partitions share boundary values (e.g. `86` appears as both the `TO` of `mq_0` and the `FROM` of `mq_1`), it's ambiguous from the docs alone which partition a row with `bucket = 86` would land in.

To confirm: `FROM` is inclusive and `TO` is exclusive (i.e. ranges behave like `[FROM, TO)`).

Please add a note clarifying this inclusive/exclusive behavior on this page:

Source: this was discussed in Slack here: https://cockroachlabs.slack.com/archives/C04U1BTF8/p1785869947752589?thread_ts=1785869947.752589&cid=C04U1BTF8

Jira issue: DOC-18294

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.