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 1jQkkE-0001bo-3a for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Apr 2020 04:42:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jQkkC-00072D-TO for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Apr 2020 04:42:48 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jQkkC-000725-Ha for pgsql-hackers@lists.postgresql.org; Tue, 21 Apr 2020 04:42:48 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jQkk5-0007ts-S1 for pgsql-hackers@lists.postgresql.org; Tue, 21 Apr 2020 04:42:47 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 03L4geL5024349 for ; Tue, 21 Apr 2020 00:42:40 -0400 From: Tom Lane To: pgsql-hackers@lists.postgresql.org Subject: Bogus documentation for bogus geometric operators MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <24347.1587444160.1@sss.pgh.pa.us> Date: Tue, 21 Apr 2020 00:42:40 -0400 Message-ID: <24348.1587444160@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk While revising the docs for the geometric operators, I came across these entries: <^ Is below (allows touching)? circle '((0,0),1)' <^ circle '((0,5),1)' >^ Is above (allows touching)? circle '((0,5),1)' >^ circle '((0,0),1)' These have got more than a few problems: 1. There are no such operators for circles, so the examples are pure fantasy. 2. What these operators do exist for is points (point_below, point_above respectively) and boxes (box_below_eq, box_above_eq). However, the stated behavior is not what the point functions actually do: point_below(PG_FUNCTION_ARGS) ... PG_RETURN_BOOL(FPlt(pt1->y, pt2->y)); point_above(PG_FUNCTION_ARGS) ... PG_RETURN_BOOL(FPgt(pt1->y, pt2->y)); So point_below would be more accurately described as "is strictly below", so its operator name really ought to be <<|. And point_above is "is strictly above", so its operator name ought to be |>>. 3. The box functions do seem to be correctly documented: box_below_eq(PG_FUNCTION_ARGS) ... PG_RETURN_BOOL(FPle(box1->high.y, box2->low.y)); box_above_eq(PG_FUNCTION_ARGS) ... PG_RETURN_BOOL(FPge(box1->low.y, box2->high.y)); But there are comments in the source code to the effect of * box_below_eq and box_above_eq are obsolete versions that (probably * erroneously) accept the equal-boundaries case. Since these are not * in sync with the box_left and box_right code, they are deprecated and * not supported in the PG 8.1 rtree operator class extension. I'm not sure how seriously to take this deprecation comment, but it is true that box_below (<<|) and box_above (|>>) have analogs for other data types while these functions don't. 4. Just for extra fun, these point operators are listed in some GIST and SP-GIST opclasses; though the box ones are not, as per that code comment. Perhaps it's too late in the v13 cycle to actually do anything about this code-wise, but what should I do documentation-wise? I'm certainly not eager to document that these operators behave inconsistently depending on which type you're talking about. regards, tom lane