Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ogkRv-0006bO-Ft for pgsql-docs@arkaria.postgresql.org; Fri, 07 Oct 2022 10:19:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ogkRu-0001KG-AV for pgsql-docs@arkaria.postgresql.org; Fri, 07 Oct 2022 10:19:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ogkRu-0001K7-3S for pgsql-docs@lists.postgresql.org; Fri, 07 Oct 2022 10:19:22 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ogkRr-0006UY-Di for pgsql-docs@lists.postgresql.org; Fri, 07 Oct 2022 10:19:21 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 5BBF65C0194; Fri, 7 Oct 2022 06:19:18 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 07 Oct 2022 06:19:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1665137958; x=1665224358; bh=O/lObW18/NkYU osslP8y0oNjxLmmTCxZ1d+pHaEfyRE=; b=TN12UX3k3WQZHltI1PwIjgqTVj4nr VorzyUvfvzX5gHWDnLBlUrBEOILLe/Qm77bJnX0fFFtoidB8cV+YvY2FgCSb9CIG ThtSmNQ7R/nDbH7Bhqf8oiC7xaMkohmXN8TTbZdAs6Jd4IGTJxZsnvmg0B1XqXxn 0Djkk3z+ttH8OMjnAUTC0ZPJ0GAk2L6LRBxTzSAQay5PNBFrzkh3QlCPek91+hij Asyn4Td6aJ/JVQf69yJgC7O5/Wo3jCSm6WsW3EcdQournn26Ecox3fjOy3INwi2U ZXTLqii7K/n9ErTvzgsT8LCWST7cnUG9RELKhKkJGfabw7YKNU1ukcWjw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeeijedgvdekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkgggtugfgjgesthekre dttddtjeenucfhrhhomheptehlvhgrrhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgv segrlhhvhhdrnhhoqdhiphdrohhrgheqnecuggftrfgrthhtvghrnhepudejveejffejve duudetvdekieeuiedtvdeileefkeevjedufeeguedvjefhueelnecuffhomhgrihhnpegv nhhtvghrphhrihhsvggusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrh grmhepmhgrihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 7 Oct 2022 06:19:18 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 152D462; Fri, 7 Oct 2022 12:19:17 +0200 (CEST) Date: Fri, 7 Oct 2022 12:19:17 +0200 From: Alvaro Herrera To: benkoshy@hotmail.com, pgsql-docs@lists.postgresql.org Subject: Re: Comparison Predicates - example - documentation seems contradictory? Message-ID: <20221007101917.3hturo5a7v25cjh7@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <166510022672.661.15495990607469895016@wrigleys.postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2022-Oct-06, PG Doc comments form wrote: > See the heading: "Table 9.2. Comparison Predicates" > > "2 BETWEEN 3 AND 1 → f" # ok this is false. > > But let's read the example immediately below (the 'not between' example) > > 2 NOT BETWEEN 1 AND 3 → f # what? This is also false. how can the negation > also be the same value? I would expect it to be true? Actually, 2 *is* between 1 and 3. So if you ask if it's NOT between, that's false. The other one is false because the boundaries are reversed, and BETWEEN does not put them in the proper order before comparing. BETWEEN SYMMETRIC does that, as explained in the line below. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/