Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cv43R-0003dU-Jk for pgsql-general@arkaria.postgresql.org; Mon, 03 Apr 2017 15:38:05 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cv43Q-0001Z0-PP for pgsql-general@arkaria.postgresql.org; Mon, 03 Apr 2017 15:38:04 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cv40z-00042S-QL for pgsql-general@postgresql.org; Mon, 03 Apr 2017 15:35:33 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cv40x-0000fy-8T for pgsql-general@postgresql.org; Mon, 03 Apr 2017 15:35:32 +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 v33FZPtt023054; Mon, 3 Apr 2017 11:35:25 -0400 From: Tom Lane To: Kyotaro HORIGUCHI cc: adrian.klaver@aklaver.com, frazer@frazermclean.co.uk, pgsql-general@postgresql.org Subject: Re: Unexpected interval comparison In-reply-to: <20170403.205118.123793330.horiguchi.kyotaro@lab.ntt.co.jp> References: <2087.1490885839@sss.pgh.pa.us> <20170331.142157.204383147.horiguchi.kyotaro@lab.ntt.co.jp> <10353.1490981364@sss.pgh.pa.us> <20170403.205118.123793330.horiguchi.kyotaro@lab.ntt.co.jp> Comments: In-reply-to Kyotaro HORIGUCHI message dated "Mon, 03 Apr 2017 20:51:18 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <23052.1491233725.1@sss.pgh.pa.us> Date: Mon, 03 Apr 2017 11:35:25 -0400 Message-ID: <23053.1491233725@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org Kyotaro HORIGUCHI writes: > Ok, the attached patch changes the result type of > interval_cmp_value from TimeOffset(=int64) to new 128 bit > LinearInterval. The value is hidden under the functions > interval_eq/ge.../cmp and all other stuff seems to use the > functions. Looking at this now ... why isn't the INT64_AU32 macro just #define INT64_AU32(i64) ((i64) >> 32) ? The business with subtracting and re-adding 1 seems unnecessary, and it also creates a risk of overflow with the minimum possible int64 value. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general