Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 70F62634249 for ; Thu, 27 May 2010 07:07:30 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 98132-03 for ; Thu, 27 May 2010 10:07:21 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ew0-f224.google.com (mail-ew0-f224.google.com [209.85.219.224]) by mail.postgresql.org (Postfix) with ESMTP id C78BB634265 for ; Thu, 27 May 2010 07:07:21 -0300 (ADT) Received: by ewy24 with SMTP id 24so493890ewy.34 for ; Thu, 27 May 2010 03:07:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=YIs26Ej+agelfwN9GP/D7J5psvaM8QDmgSLeiMq9VZ8=; b=Hz0R2JRwGXo2ibNs06MZPuwvfBgA0uOrkVkGv+QBYclNRfKIOPk7X2xWY/BU70oe/K MLlF5w67bvtdCDRHduAaZkBpT3YzWgS52rwjB32lCLspJqhBemJiT3FYwBAo1fdlFMrE PbYNemF3etvWXb2A6h62AVQCpAI4QV00hkceA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=ai3ZuN8woGHQ8dJjAnZ2fUl55Q2cOAi7R1gAbBclyHZ1fiwWxTrh0c/RqeIBic6VbB C/03U2sBVEaSTkyBTF8+Vv3CIuzXXlvxZty9OWjsLZygsqLzh8vA0m+UNH3kfBOdFJwZ u+ojKkK2VOxFTOJ4OdKIoLnUEQy3x3YqYD8lg= MIME-Version: 1.0 Received: by 10.213.16.143 with SMTP id o15mr2028592eba.94.1274954840125; Thu, 27 May 2010 03:07:20 -0700 (PDT) Received: by 10.213.28.72 with HTTP; Thu, 27 May 2010 03:07:20 -0700 (PDT) Date: Thu, 27 May 2010 12:07:20 +0200 Message-ID: Subject: Check set of date intervals From: Anton Gavazuk To: pgsql-sql@postgresql.org Content-Type: multipart/alternative; boundary=0015174bf06c59b2c80487908e01 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.801 tagged_above=-5 required=5 tests=BAYES_50=0.8, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201005/122 X-Sequence-Number: 34170 --0015174bf06c59b2c80487908e01 Content-Type: text/plain; charset=ISO-8859-1 Hi all, have such relation A: PERIOD_ID | DATE_START | DATE_END | OTHER_ATTRIBUTES... 1 | 01.01.2010 | 01.02.2010 .... 2 | 03.02.2010 | 04.03.2010 ..... ...... I want to search among periods for the set of periods which completely covers passed search period. As example - if I pass search period '15.01.2010 to 15.02.2010' the result set must be empty because there is gap between 01.02 and 03.02. please, suggest an idea how to implement this in SQL without writing a procedure. Thanks, Anton --0015174bf06c59b2c80487908e01 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi all,

have such relation A:

PERIOD_ID | DATE_START | DATE_E= ND | OTHER_ATTRIBUTES...
=A0=A0=A0=A0=A0 1 =A0=A0=A0=A0=A0=A0=A0 | 01.01= .2010=A0=A0=A0=A0=A0 |=A0 01.02.2010 ....
=A0=A0=A0=A0=A0 2=A0=A0=A0=A0= =A0=A0=A0=A0 | 03.02.2010=A0=A0=A0=A0=A0 |=A0 04.03.2010 .....
......
I want to search among periods for the set of periods which completely = covers passed search period.
As example - if I pass search period '1= 5.01.2010 to 15.02.2010' the result set must be empty because there is = gap between 01.02 and 03.02.

please, suggest an idea how to implement this in SQL without writing a = procedure.

Thanks,
Anton
--0015174bf06c59b2c80487908e01--