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 1njaBl-0005k7-Nx for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Apr 2022 05:26:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1njaBk-0003Uu-Bi for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Apr 2022 05:26:08 +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 1njaBk-0003Uj-2J for pgsql-hackers@lists.postgresql.org; Wed, 27 Apr 2022 05:26:08 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1njaBd-0006Bm-UE for pgsql-hackers@lists.postgresql.org; Wed, 27 Apr 2022 05:26:06 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 23R5Q0Ol318629; Wed, 27 Apr 2022 01:26:00 -0400 From: Tom Lane To: Jian He cc: pgsql-hackers@lists.postgresql.org Subject: Re: Fwd: range of composite types! In-reply-to: References: Comments: In-reply-to Jian He message dated "Wed, 27 Apr 2022 10:33:49 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <318627.1651037160.1@sss.pgh.pa.us> Date: Wed, 27 Apr 2022 01:26:00 -0400 Message-ID: <318628.1651037160@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jian He writes: >> for that means the following sql queries should return* false:* >> select mytyperange ( >> (1,'2022-01-01')::mytype, >> (8, '2022-01-31')::mytype, '[]') @> (2, '2020-01-19')::mytype; Why should that return false? The comparison rules for composites say that you compare the first column, only if that's equal compare the second, etc. Here, "2" is between "1" and "8" so the contents of the second column don't matter. regards, tom lane