Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-sql by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group