Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U77cj-0005SQ-VU for pgsql-sql@arkaria.postgresql.org; Sun, 17 Feb 2013 17:01:58 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1U77cj-0007aJ-7b for pgsql-sql@arkaria.postgresql.org; Sun, 17 Feb 2013 17:01:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U77ci-0007aE-KU for pgsql-sql@postgresql.org; Sun, 17 Feb 2013 17:01:56 +0000 Received: from mout.gmx.net ([212.227.15.18]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U77cg-0004JD-FI for pgsql-sql@postgresql.org; Sun, 17 Feb 2013 17:01:56 +0000 Received: from mailout-de.gmx.net ([10.1.76.35]) by mrigmx.server.lan (mrigmx002) with ESMTP (Nemesis) id 0LcmCH-1UZ43q026h-00k5Ht for ; Sun, 17 Feb 2013 18:01:53 +0100 Received: (qmail invoked by alias); 17 Feb 2013 17:01:52 -0000 Received: from mue-88-130-27-122.dsl.tropolys.de (EHLO [192.168.1.113]) [88.130.27.122] by mail.gmx.net (mp035) with SMTP; 17 Feb 2013 18:01:52 +0100 X-Authenticated: #14269776 X-Provags-ID: V01U2FsdGVkX1/u8Ygw31juoQp94wMjR8G850gRys7fvfftQRQCm/ k2UFFkHdcXGDYA Message-ID: <51210D23.9070403@gmx.net> Date: Sun, 17 Feb 2013 18:02:27 +0100 From: Andreas User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: How to reject overlapping timespans? Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org Hi, I need to store data that has a valid timespan with start and enddate. objects ( id, name, ... ) object_data ( object_id referencs objects(id), startdate, enddate, ... ) nothing special, yet How can I have PG reject a data record where the new start- or enddate lies between the start- or enddate of another record regarding the same object_id? Also it isn't allowed that such timespans lie within another. There can be times where no valid data exists but there can't be more than one valid data-record for the same point in time. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql