Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qwMB7-00BHdR-7U for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Oct 2023 12:43:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qwMB4-00FIW2-R6 for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Oct 2023 12:43:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qwMB4-00FIVu-D9 for pgsql-hackers@lists.postgresql.org; Fri, 27 Oct 2023 12:43:02 +0000 Received: from meesny.iki.fi ([195.140.195.201]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qwMB0-00370s-L2 for pgsql-hackers@lists.postgresql.org; Fri, 27 Oct 2023 12:43:01 +0000 Received: from [192.168.1.115] (dsl-hkibng22-54f8db-125.dhcp.inet.fi [84.248.219.125]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by meesny.iki.fi (Postfix) with ESMTPSA id 4SH2Pq6xdSzyPg; Fri, 27 Oct 2023 15:42:53 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1698410576; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I5qHcYCryFWHhItn0TDmN+4BKytK1Xcv14i+zlGkzXY=; b=r68Cvz3xPnQCeaPJESHLlljhwE0F3ihLpwQ2YkuDb/M4qy2GgeNF1Ba28rjmWan7I0lhgK wwDsaTkjBbH7GtMjaGug/lIdlyiSL9jUGujv7TgJFZpzeKJZTcO5mIdSXtor2BIzGMG1ph GAdvlXUEITdelfwU/mM5wgJdGKk7jmk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1698410576; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I5qHcYCryFWHhItn0TDmN+4BKytK1Xcv14i+zlGkzXY=; b=N1KM9/zNNeoV9S6bVxtLVAAjlk9Lp00moaHHW+rc/yA8frmJJydyRlee0qVlfJGx/3VOyN w2EnkbPGurFZmsgvFBAvZAdUuUrPJGFUc04VSaCa/rr+bWomSRnwuRhsGiFVP0HEykkjlo d0f2hB1OO58Dwr3WAHFbQBbk9H7NybQ= ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi ARC-Seal: i=1; s=meesny; d=iki.fi; t=1698410576; a=rsa-sha256; cv=none; b=QnhB+4PVtzAEmXuEKi6Nb33U5FsKJk7hN0Ha6T7qrDRFNudoTvCLfsKj9R1xCzsGf8v9fD kazp6xU9F5H/5pUw6MgI6PtXzkbyqk2m2mfKA266zF+mJe5Q+I6HUrOexB8vCBoeEZuo0A PGWOwRnWOuX6P5dckrnuCjuE488cTTo= Message-ID: <63b56dae-cfb6-4a84-ac8b-fd3a08ea1312@iki.fi> Date: Fri, 27 Oct 2023 15:42:52 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: btree_gin: Incorrect leftmost interval value Content-Language: en-US To: Dean Rasheed , PostgreSQL Hackers References: From: Heikki Linnakangas In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 27/10/2023 12:26, Dean Rasheed wrote: > In contrib/btree_gin, leftmostvalue_interval() does this: > > leftmostvalue_interval(void) > { > Interval *v = palloc(sizeof(Interval)); > > v->time = DT_NOBEGIN; > v->day = 0; > v->month = 0; > return IntervalPGetDatum(v); > } > > which is a long way short of the minimum possible interval value. Good catch! > Attached is a patch fixing this by setting all the fields to their > minimum values, which is guaranteed to be less than any other > interval. LGTM. I wish extractQuery could return "leftmost" more explicitly, so that we didn't need to construct these leftmost values. But I don't think that's supported by the current extractQuery interface. -- Heikki Linnakangas Neon (https://neon.tech)