Re: [SQL] can this be done with a check expression?

2012-08-02 Thread Andreas Kretschmer
Tom Lane wrote: > Wayne Cuddy writes: > A less bogus way of doing things is to use an EXCLUDE constraint, > although that will restrict you to be running PG 9.0 or newer. You > also need some way of representing the ranges as indexable objects. > In 9.0 or 9.1, probably the best way is to use c

Re: [SQL] can this be done with a check expression?

2012-08-02 Thread Tom Lane
Wayne Cuddy writes: > I have a table with 3 columns: > name text > start_id integer > end_id integer > start_id and end_id are ranges which must not overlap but can have gaps > between them. Is it possible to formulate a table check constraint that > can verify that either id does not fall within

[SQL] can this be done with a check expression?

2012-08-02 Thread Wayne Cuddy
I have a table with 3 columns: name text start_id integer end_id integer start_id and end_id are ranges which must not overlap but can have gaps between them. Is it possible to formulate a table check constraint that can verify that either id does not fall within an existing range at insert time?