Skip to content

CREATE INDEX succeeds but ignores operator classes and descending sort order #3229

Description

@off-axis

Doltgres 1.3.0 (Django 6) accepts PostgreSQL index definitions containing operator classes and descending columns, but silently changes their semantics. The SQL client receives success, but only the Doltgres server log contains warnings.

This causes ORM migrations to complete successfully while the resulting schema differs from the requested one.

Repro

CREATE TABLE index_warning_repro (
    id bigint PRIMARY KEY,
    owner_id bigint NOT NULL,
    name varchar(255) NOT NULL,
    created_at timestamptz NOT NULL
);

CREATE INDEX index_warning_pattern
    ON index_warning_repro (name varchar_pattern_ops);

CREATE INDEX index_warning_newest
    ON index_warning_repro (owner_id, created_at DESC, id DESC);

Doltgres logs:

index attribute operator class is not yet supported, ignoring
descending indexes are not yet supported, ignoring sort order

Inspecting pg_indexes shows that the unsupported attributes were removed:

CREATE INDEX index_warning_pattern
    ON public.index_warning_repro USING btree (name)

CREATE INDEX index_warning_newest
    ON public.index_warning_repro USING btree (owner_id, created_at, id)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions