Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VGfov-0003Ol-UG for pgsql-bugs@arkaria.postgresql.org; Tue, 03 Sep 2013 01:54:18 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VGfov-00010G-4m for pgsql-bugs@arkaria.postgresql.org; Tue, 03 Sep 2013 01:54:17 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VGfot-000105-1R for pgsql-bugs@postgresql.org; Tue, 03 Sep 2013 01:54:15 +0000 Received: from mail-pb0-f48.google.com ([209.85.160.48]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VGfop-0005Md-WE for pgsql-bugs@postgresql.org; Tue, 03 Sep 2013 01:54:14 +0000 Received: by mail-pb0-f48.google.com with SMTP id ma3so5307856pbc.21 for ; Mon, 02 Sep 2013 18:54:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:content-type:mime-version; bh=wyQ2LgFeBOY8VTBsctZM2BH0EDXMTXIsIVk0zEN5Zd4=; b=HUF6TWSqnOaOVRXtCL2pS9zdSAavtsD45/zKW4kNyiVIiAQOFFR+RVlI/bHO1h3iXx MQrcT2lrXvvxqeoBqFFZTFcFgr7HRl3/HomyQRKUnfyHefANhHue6tpk7AYw7ZhPO3rz y/YMwZfPheb74hWSRGsxV7xVli+Uc8URDHg7dnZ74Y71bt1YHy9+uMSoskwGvZ9+IXhZ si+Q1FkKHRUZbXoNGaBnqUWnZqti+TNO8+8bI7QRwmk67c8GPcZzwRB2xxuAJo7bmsGa AvPai2l6TAGtpdFtFaxmLpjgxbGzOe3rBSgOTTVaaV8nAAdVPMw/OGO9B+RW0Va/fPNm 7REA== X-Gm-Message-State: ALoCoQkL5auyZM7Amf5meW0rCxZkfo45qo0zPmsVFP9SRQC8G8wCet8M1uj9quKe4Ce1GXdk/ydj X-Received: by 10.68.225.131 with SMTP id rk3mr175479pbc.183.1378173250982; Mon, 02 Sep 2013 18:54:10 -0700 (PDT) Received: from [192.168.0.105] (c-69-181-249-16.hsd1.ca.comcast.net. [69.181.249.16]) by mx.google.com with ESMTPSA id zv11sm20323843pab.3.1969.12.31.16.00.00 (version=SSLv3 cipher=RC4-SHA bits=128/128); Mon, 02 Sep 2013 18:54:10 -0700 (PDT) Message-ID: <1378173248.19551.2.camel@jdavis> Subject: Re: BUG #8367: wrong example in 8.17.10 From: Jeff Davis To: Tom Lane Cc: koizumistr@minos.ocn.ne.jp, pgsql-bugs@postgresql.org Date: Mon, 02 Sep 2013 18:54:08 -0700 In-Reply-To: <30472.1375806439@sss.pgh.pa.us> References: <30472.1375806439@sss.pgh.pa.us> Content-Type: multipart/mixed; boundary="=-G1uNg4JLJ8mXlvzTZ+gJ" X-Mailer: Evolution 3.6.4-0ubuntu1 Mime-Version: 1.0 X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org --=-G1uNg4JLJ8mXlvzTZ+gJ Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit On Tue, 2013-08-06 at 12:27 -0400, Tom Lane wrote: > koizumistr@minos.ocn.ne.jp writes: > > In 8.17.10 "Constraints on Ranges" of PostgreSQL 9.2.4 Documentation, a > > constraint will prevent the overlapping values in an example. > > But in the example, range [2010-01-01 11:30, 2010-01-01 13:00) and range > > [2010-01-01 14:45, 2010-01-01 15:45) do not overlap. > > No, but the second one overlaps with the range value shown in 8.17.2. > So this is correct if it's understood as a continuation of that example. > Still, it's kind of a long way from 8.17.2 to 8.17.10. It might be better > if this section were recast to use a standalone example --- Jeff, what do > you think? That sounds reasonable, patch attached. Minor change, so if nobody has any more suggestions I'll commit it tomorrow night. Regards, Jeff Davis --=-G1uNg4JLJ8mXlvzTZ+gJ Content-Disposition: attachment; filename="rangetypes-example.patch" Content-Type: text/x-patch; name="rangetypes-example.patch"; charset="UTF-8" Content-Transfer-Encoding: 7bit *** a/doc/src/sgml/rangetypes.sgml --- b/doc/src/sgml/rangetypes.sgml *************** *** 451,457 **** CREATE INDEX reservation_idx ON reservation USING gist (during); range type. For example: ! ALTER TABLE reservation ADD EXCLUDE USING gist (during WITH &&); That constraint will prevent any overlapping values from existing --- 451,460 ---- range type. For example: ! CREATE TABLE reservation ( ! during tsrange, ! EXCLUDE USING gist (during WITH &&) ! ); That constraint will prevent any overlapping values from existing *************** *** 459,472 **** ALTER TABLE reservation ADD EXCLUDE USING gist (during WITH &&); INSERT INTO reservation VALUES ! (1108, '[2010-01-01 11:30, 2010-01-01 13:00)'); INSERT 0 1 INSERT INTO reservation VALUES ! (1108, '[2010-01-01 14:45, 2010-01-01 15:45)'); ERROR: conflicting key value violates exclusion constraint "reservation_during_excl" ! DETAIL: Key (during)=([ 2010-01-01 14:45:00, 2010-01-01 15:45:00 )) conflicts ! with existing key (during)=([ 2010-01-01 14:30:00, 2010-01-01 15:30:00 )). --- 462,475 ---- INSERT INTO reservation VALUES ! ('[2010-01-01 11:30, 2010-01-01 15:00)'); INSERT 0 1 INSERT INTO reservation VALUES ! ('[2010-01-01 14:45, 2010-01-01 15:45)'); ERROR: conflicting key value violates exclusion constraint "reservation_during_excl" ! DETAIL: Key (during)=(["2010-01-01 14:45:00","2010-01-01 15:45:00")) conflicts ! with existing key (during)=(["2010-01-01 11:30:00","2010-01-01 15:00:00")). *************** *** 479,484 **** with existing key (during)=([ 2010-01-01 14:30:00, 2010-01-01 15:30:00 )). --- 482,488 ---- are equal: + CREATE EXTENSION btree_gist; CREATE TABLE room_reservation ( room text, during tsrange, *************** *** 492,499 **** INSERT 0 1 INSERT INTO room_reservation VALUES ('123A', '[2010-01-01 14:30, 2010-01-01 15:30)'); ERROR: conflicting key value violates exclusion constraint "room_reservation_room_during_excl" ! DETAIL: Key (room, during)=(123A, [ 2010-01-01 14:30:00, 2010-01-01 15:30:00 )) conflicts with ! existing key (room, during)=(123A, [ 2010-01-01 14:00:00, 2010-01-01 15:00:00 )). INSERT INTO room_reservation VALUES ('123B', '[2010-01-01 14:30, 2010-01-01 15:30)'); --- 496,503 ---- INSERT INTO room_reservation VALUES ('123A', '[2010-01-01 14:30, 2010-01-01 15:30)'); ERROR: conflicting key value violates exclusion constraint "room_reservation_room_during_excl" ! DETAIL: Key (room, during)=(123A, ["2010-01-01 14:30:00","2010-01-01 15:30:00")) conflicts ! with existing key (room, during)=(123A, ["2010-01-01 14:00:00","2010-01-01 15:00:00")). INSERT INTO room_reservation VALUES ('123B', '[2010-01-01 14:30, 2010-01-01 15:30)'); --=-G1uNg4JLJ8mXlvzTZ+gJ Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs --=-G1uNg4JLJ8mXlvzTZ+gJ--