Skip to content

Multi-column gist index is displayed in wrong order #8430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ab-pm opened this issue Feb 9, 2025 · 1 comment
Closed

Multi-column gist index is displayed in wrong order #8430

ab-pm opened this issue Feb 9, 2025 · 1 comment
Assignees
Milestone

Comments

@ab-pm
Copy link

ab-pm commented Feb 9, 2025

I'm using a multi-column GiST index exclusion constraint. It was created with a specific order of columns, however the "SQL" view on the table or constraint show them in the wrong order.

To Reproduce

CREATE EXTENSION IF NOT EXISTS btree_gist;
CREATE TABLE a_b_relation (
    a integer NOT NULL,
    b integer NOT NULL,
    valid tstzrange NOT NULL,
    CONSTRAINT a_b_excl EXCLUDE USING gist (
        a WITH =,
        b WITH =,
        valid WITH &&
    )
);

Then visit the "SQL" tab for the public.a_b_relation table. It'll show

CREATE TABLE IF NOT EXISTS public.a_b_relation
(
    a integer NOT NULL,
    b integer NOT NULL,
    valid tstzrange NOT NULL,
    CONSTRAINT a_b_excl EXCLUDE USING gist (
        valid WITH &&,
        b WITH =,
        a WITH =)

)

Similarly, the "SQL" view of the constraint itself has the same; and in the "Properties"->"Constraints"->"Exclude" dialog the "Columns/Expressions" table column also lists them in the wrong order.

Expected behavior

It should display the exclusion constraint with the rows in the same order they were created in. Notice that psql gets it right:

example=# \d a_b_relation 
             Table "public.a_b_relation"
 Column |   Type    | Collation | Nullable | Default 
--------+-----------+-----------+----------+---------
 a      | integer   |           | not null | 
 b      | integer   |           | not null | 
 valid  | tstzrange |           | not null | 
Indexes:
    "a_b_excl" EXCLUDE USING gist (a WITH =, b WITH =, valid WITH &&)

Environment:

  • OS: Ubuntu
  • Version: 8.14
  • Mode: Desktop

Additional context

I found the thread bugfix: dlgIndex column order from 2009 on the mailing list which might be related, but I guess this is about ordering (ASC, DESC etc) in a column, not the order amongst columns.

@ab-pm ab-pm added the Bug label Feb 9, 2025
@akshay-joshi akshay-joshi moved this to 🆕 New in Current Sprint (195) Feb 12, 2025
@pravesh-sharma pravesh-sharma self-assigned this Feb 12, 2025
@pravesh-sharma pravesh-sharma moved this from 🆕 New to 🏗 In Progress in Current Sprint (195) Feb 12, 2025
pravesh-sharma added a commit to pravesh-sharma/pgadmin4 that referenced this issue Feb 12, 2025
pravesh-sharma added a commit to pravesh-sharma/pgadmin4 that referenced this issue Feb 12, 2025
@pravesh-sharma pravesh-sharma moved this from 🏗 In Progress to In Review in Current Sprint (195) Feb 13, 2025
akshay-joshi pushed a commit that referenced this issue Feb 18, 2025
@akshay-joshi akshay-joshi moved this from In Review to In Testing in Current Sprint (195) Feb 18, 2025
@akshay-joshi akshay-joshi added this to the 9.1 milestone Feb 18, 2025
@yogeshmahajan-1903 yogeshmahajan-1903 self-assigned this Feb 25, 2025
@yogeshmahajan-1903
Copy link
Contributor

Working fine.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants