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 1jJ3Bk-0001Cg-AI for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Mar 2020 22:47:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jJ3Bh-0007zj-5p for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Mar 2020 22:47:21 +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 1jJ3Bg-0007yS-ME for pgsql-hackers@lists.postgresql.org; Mon, 30 Mar 2020 22:47:20 +0000 Received: from cyclops.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jJ3Bc-0001vg-PP for pgsql-hackers@postgresql.org; Mon, 30 Mar 2020 22:47:18 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id E7B5721C5703; Tue, 31 Mar 2020 01:47:12 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from [192.168.0.103] (unknown [188.235.32.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 4C1E521C08BB; Tue, 31 Mar 2020 01:47:12 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1585608432; bh=LTYbGtGRRQumIh00y79ihfmwrBm34yDPQTiAkDY+rtA=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=oLGpSwL7DruHDKqYH4+bm5WLujHWVTWz13fHbgtdLX/+KOQVRMyWBVCfjsOu/oBkn 6OZ6CCvkucXEgtmPLXEX3xA07SWKajjE58zG4/4lfTFrqEXvwplwaxeaSljv3xTmK2 +Wmjn3JTioyIvHuPNMffnld82Js6Ly9e8+7i9GV4= Subject: Re: fix for BUG #3720: wrong results at using ltree To: Tom Lane , Pgsql Hackers Cc: =?UTF-8?Q?Filip_Rembia=c5=82kowski?= , Tomas Vondra , Alexander Korotkov , Oleg Bartunov , Thomas Munro , Teodor Sigaev References: <28639.1554565562@sss.pgh.pa.us> <5eedfd9e-2f14-a2df-3bd9-4c92eb0f08a5@postgrespro.ru> <20200124182915.zz7hzdkijzsb4ic4@development> <19375.1585438012@sss.pgh.pa.us> <15582.1585529626@sss.pgh.pa.us> <23304.1585591242@sss.pgh.pa.us> <943dc224-eb82-8abd-15c3-f4b516f89767@postgrespro.ru> <3007.1585605566@sss.pgh.pa.us> <3843.1585606362@sss.pgh.pa.us> <9247ddc2-d1e0-7d62-55a6-62a089e99a8a@postgrespro.ru> <5210.1585607748@sss.pgh.pa.us> From: Nikita Glukhov Organization: Postgres Professional Message-ID: <4c00219b-7094-e568-cc2c-6a52cf621701@postgrespro.ru> Date: Tue, 31 Mar 2020 01:47:05 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <5210.1585607748@sss.pgh.pa.us> Content-Type: multipart/alternative; boundary="------------E530EC6039F2126B40A771FE" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------E530EC6039F2126B40A771FE Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 31.03.2020 1:35, Tom Lane wrote: > Nikita Glukhov writes: >> And we even can simply transform this tail call into a loop: >> >> -if (tlen > 0 && qlen > 0) >> +while (tlen > 0 && qlen > 0) > Yeah, the same occurred to me ... and then we can drop the other loop too. I think now it looks as simple as the whole algorithm is. -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company --------------E530EC6039F2126B40A771FE Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit


On 31.03.2020 1:35, Tom Lane wrote:
Nikita Glukhov <n.gluhov@postgrespro.ru> writes:
And we even can simply transform this tail call into a loop:

-if (tlen > 0 && qlen > 0)
+while (tlen > 0 && qlen > 0)
Yeah, the same occurred to me ... and then we can drop the other loop too.
I think now it looks as simple as the whole algorithm is.

--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
--------------E530EC6039F2126B40A771FE--