pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Wayne Cuddy <lists-pgsql@useunix.net>
To: PostgreSQL <pgsql-sql@postgresql.org>
Subject: can this be done with a check expression?
Date: Thu, 2 Aug 2012 19:10:43 -0400
Message-ID: <20120802231043.GA16173@slacker.ja10629.home> (raw)

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



view thread (7+ messages)  latest in thread

Message-ID: <20120802231043.GA16173@slacker.ja10629.home>
Permalink:  ../20120802231043.GA16173@slacker.ja10629.home/
Also on:    postgresql.org/message-id/20120802231043.GA16173@slacker.ja10629.home

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: lists-pgsql@useunix.net
  Subject: Re: can this be done with a check expression?
  In-Reply-To: <20120802231043.GA16173@slacker.ja10629.home>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox