can this be done with a check expression?

From: Wayne Cuddy <lists-pgsql(at)useunix(dot)net>
To: PostgreSQL <pgsql-sql(at)postgresql(dot)org>
Subject: can this be done with a check expression?
Date: 2012-08-02 23:10:43
Message-ID: 20120802231043.GA16173@slacker.ja10629.home
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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? IE prevent overlaps during insert?

Thanks,
Wayne

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2012-08-02 23:23:34 Re: can this be done with a check expression?
Previous Message Samuel Gendler 2012-08-01 19:40:09 query structure for selecting row by tags