3

Assuming the following index:

CREATE INDEX CONCURRENTLY blocked_date_idx_on_since_until_range
  ON blocked_date
  USING gist(
    tstzrange(
      "blocked_since",
      "blocked_until",
      '[]'
    )
  );

Which is a range on 2 dates, I'd like to:

ALTER TABLE blocked_date
  ADD CONSTRAINT blocked_date_since_until_overlap
  EXCLUDE
    USING INDEX blocked_date_idx_on_since_until_range WITH &&;

This syntax is not valid (I get an error), but I can't find a valid one where I can specify which operator to use on the index. What is the right syntax for the ALTER TABLE part?

1 Answer 1

4

Currently there is no syntax to achieve this. You are required to create the constraint directly and can't create the index upfront.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.