Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gIowB-0004kE-Kk for pgsql-bugs@arkaria.postgresql.org; Sat, 03 Nov 2018 05:57:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gIow6-0005ay-Hm for pgsql-bugs@arkaria.postgresql.org; Sat, 03 Nov 2018 05:57:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gIow4-0005ar-PG for pgsql-bugs@lists.postgresql.org; Sat, 03 Nov 2018 05:57:30 +0000 Received: from [66.111.4.27] (helo=out3-smtp.messagingengine.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gIow1-0001kB-8g for pgsql-bugs@postgresql.org; Sat, 03 Nov 2018 05:57:27 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 306F521B88; Sat, 3 Nov 2018 01:57:04 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Sat, 03 Nov 2018 01:57:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=EJLvJSHZ4vM9HYdMGoPkuFBzGbg NW9/EH6sDsX85WqY=; b=paNph6VSAw4FRQpidwqwl3gUYfe8H+wvjban6BVc/cZ KaF1K/SxZZBrAZVhBzJ0gSZ9X8yf1ltxCkBaQUOED+J335ephlMV+T6tzn8yIIZF Y2Zi1yGSNgCeoWWbY/kin0ErE5bRaumaW99b6KzKkqcx3Zeb4ec9jFHKhdykgOpG KmxAfRj3nAgYB/U0REr/Mt+y/yc9qN5mCWc/H5KzSw9nmH3VPRWvGJSioYhcs/Df mDK1RSYu2+dfMBl3i07nWKiV2eRFyeJY3kPAH3o7WE4UvSGvRlHsHrKA19e2pkqn Ma3l17B9H4O+mSdfQFenPjLQ1FzPpbEd8Sw4YbIEGQg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=EJLvJS HZ4vM9HYdMGoPkuFBzGbgNW9/EH6sDsX85WqY=; b=qmfxTpbjToa4iGuQ9B3Fzt TjhDPoh9UZzEAFkeElSewG72e+J2wSHjZGx74iS0BnpjoKK9cSgV1bCdo52A47oZ OSZjMLxC3XUhe4me8KhMe5OzrRQZfd8g6MM2sKPUpPpvqVuBPYuac34HDmV9hHm7 Rby8f9AsLTZJXuyfzLw5zzn9vt6HQkA/hwjTHAO/horIIBKNb4AQ59bUV9Td3U4x Ga3sMO2kC3NENcT5XGvbo1vDJglPKFfvNmHZKKKW0bJbTAJBXohjD8HuJtrN6ecM kuiXLHv+Ovm4mdqPmmHKDbTb9xqOmzgQyAIy4IzeoDsqeebRB9HixP55qVSSF/pQ == X-ME-Sender: X-ME-Proxy: Received: from intern.anarazel.de (c-98-210-140-171.hsd1.ca.comcast.net [98.210.140.171]) by mail.messagingengine.com (Postfix) with ESMTPA id DE92DE40E6; Sat, 3 Nov 2018 01:57:02 -0400 (EDT) Date: Fri, 2 Nov 2018 22:57:00 -0700 From: Andres Freund To: Andrew Gierth Cc: Tom Lane , =?utf-8?Q?Ond=C5=99ej?= Bouda , pgsql-bugs@postgresql.org Subject: Re: Wrong aggregate result when sorting by a NULL value Message-ID: <20181103055700.etsffelwr2rhrphh@alap3.anarazel.de> References: <2a505161-2727-2473-7c46-591ed108ac52@email.cz> <30923.1541171251@sss.pgh.pa.us> <32176.1541172886@sss.pgh.pa.us> <20181102154050.6prklkv37wdqvilx@alap3.anarazel.de> <87y3ab2ykj.fsf@news-spur.riddles.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87y3ab2ykj.fsf@news-spur.riddles.org.uk> X-Host-Lookup-Failed: Reverse DNS lookup failed for 66.111.4.27 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 2018-11-02 17:34:43 +0000, Andrew Gierth wrote: > >>>>> "Andres" == Andres Freund writes: > > >> Andres, do you have time to look at this right now? > > Andres> Thanks for bisecting. I'll take a look later today. > > Looks like this: > > + scratch.d.agg_strict_input_check.nargs = numInputs; > > should have been pertrans->numTransInputs instead? That looks like it's precisely the reason. I'll push something tomorrow PST morning, crediting both you (diagnosis) and Tom (bisecting) obviously, unless you prefer to do so yourself. It's a bit sad that we don't have any tests that test this :/. I'll add something for the specific case, but that'll obviously not be exhaustive. Greetings, Andres Freund