Skip to content

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

Description

@fabiog1901

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:

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:
https://www.cockroachlabs.com/docs/v26.2/alter-index#define-a-range-partition-on-an-index

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

Jira issue: DOC-18294

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions