Being a new user of postgres, I have created a database in postgres 13. It contains tables including 4 Fields
- ID integer (PK)
- HoleID varchar(20)
- From numeric NOT NULL CHECK (From>=0)
- To numeric
- Cat varchar (20)
I want to create a constraint that will check that for an identical entity number, the From and To fields of a record must not overlap with another record.
I have proposed the exclude constraint below but it does not work
ADD CONSTRAINT no_overlap EXCLUDE USING GIST ("HoleID" WITH =, ("mFrom", "mTo") WITH &&);
Thank you for helping me.