Skip to content
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

Add exclusion constraints to analyze/read_schema #658

Merged

Conversation

kvch
Copy link
Contributor

@kvch kvch commented Feb 5, 2025

This PR adds support for displaying exclusion constraints in the output of analyze/read_schema.

Attributes:

  • name: name of the constraint
  • method: selected index method (exclude.index_method option)
  • columns: the list of columns included in the constraint
  • predicate: conditional expression if partials index
  • definition: constraint definition
go run . analyze
{
...
  "excludeConstraints": {
    "forbid_duplicated_titles": {
      "name": "forbid_duplicated_titles",
      "method": "btree",
      "predicate": "(title IS NOT NULL)",
      "columns": [
        "title"
      ],
      "definition": "EXCLUDE USING btree (title WITH =) WHERE ((title IS NOT NULL))"
    }
  },
...
}

Furthermore, I added a new attribute called exclusion to indexes to show if the index belongs to an exclusion constraint.


// Elements is the elements of the exclude constraint
Elements string `json:"elements"`
// Method is the index method of the exclude constraint
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to Method so it is consistent with Method in indexes.

Expose exclusion constraints in the output of `read_schema` and
`analyze`.
@kvch kvch force-pushed the feature-expose-exclusion-constraint-in-analyze branch from 4b756b6 to f943a56 Compare February 5, 2025 13:47
@kvch kvch changed the title Add exclusion constraints to analyze Add exclusion constraints to analyze/read_schema Feb 5, 2025
@kvch kvch merged commit c0dc021 into xataio:main Feb 5, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants