Skip to content

Additional index on table breaks Mathesar's primary key recognition #4656

@zackkrida

Description

@zackkrida

Description

Using the following table and constraints:

CREATE TABLE public.index_test (
    id uuid NOT NULL DEFAULT gen_random_uuid(),
    col_a text NOT NULL
);

-- Primary Key
ALTER TABLE public.index_test
    ADD CONSTRAINT index_test_pkey PRIMARY KEY (id);

-- Index on col_a and id
CREATE INDEX ix_index_test_col_a_id ON public.index_test (col_a, id);

Mathesar does not detect this table as having a Primary key:

Image

Removing the ix_index_test_col_a_id index fixes the problem.

Expected behavior

Mathesar correctly identifies the table's primary key.

To Reproduce

Load this SQL into a local Mathesar instance (docker exec -it mathesar_dev_db psql -U mathesar) and verify the behavior.

Metadata

Metadata

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions