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 1pIA13-0005Sf-QX for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Jan 2023 15:06:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pIA10-0004ZJ-Vb for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Jan 2023 15:06:14 +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 1pIA0z-0004Z5-Ve for pgsql-hackers@lists.postgresql.org; Wed, 18 Jan 2023 15:06:14 +0000 Received: from new3-smtp.messagingengine.com ([66.111.4.229]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pIA0v-0008Ge-CI for pgsql-hackers@lists.postgresql.org; Wed, 18 Jan 2023 15:06:12 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 3C4FB581DF8; Wed, 18 Jan 2023 10:06:05 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 18 Jan 2023 10:06:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1674054365; x=1674061565; bh=U 6wofha6XndXvccyugEzAS7QMcxVzsoshQz1J8tbeNs=; b=e9sY3dWHTFTFmmFxs 36aOLjZEkGIotq93nwHd9YMTTkjqYJO1VTbkCF3NXoejpCj008LgAw0L0u++jDD9 MMy+uDavHe0fgEicjzfY2mCf/E84x0ltyGtT66ev2q0PqTc1Qr8dXOGOEsaoEOCh ZGLphx20En0K8vH1E0rRX9nT/o1CF2Dziq2CnUxpHGh3QA+Gw4aSnqrWjCXe5e1t VmUs/7dMVH+rkj5UdKsR+XHvhzJ5zuGw4z1eayfhjltSwaF2aQTy/RHIHmt2t6SY ou+DB9qqgyRen41V3rQsHzhuerr0FFME59WtgGmVc6mf3qKdr0U+WN6dH8GgZH9b 5ng/Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedruddtkedgjedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthekredttdefjeenucfhrhhomheprfgvthgv rhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsegvnhhtvg hrphhrihhsvggusgdrtghomheqnecuggftrfgrthhtvghrnheptefggfffvedvgfettedv geduteehtdefgeeikefgvedvleefhefffeevvdfhvddvnecuffhomhgrihhnpehtgihtrd hinhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehp vghtvghrrdgvihhsvghnthhrrghuthesvghnthgvrhhprhhishgvuggsrdgtohhm X-ME-Proxy: Feedback-ID: i131946ab:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 18 Jan 2023 10:06:03 -0500 (EST) Message-ID: <464ece4e-fabb-ddac-60da-897493c4476d@enterprisedb.com> Date: Wed, 18 Jan 2023 16:06:02 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: ANY_VALUE aggregate Content-Language: en-US To: Vik Fearing , PostgreSQL Hackers References: <5cff866c-10a8-d2df-32cb-e9072e6b04a2@postgresfriends.org> From: Peter Eisentraut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 05.12.22 21:18, Vik Fearing wrote: > On 12/5/22 15:57, Vik Fearing wrote: >> The SQL:2023 Standard defines a new aggregate named ANY_VALUE.  It >> returns an implementation-dependent (i.e. non-deterministic) value >> from the rows in its group. >> >> PFA an implementation of this aggregate. > > Here is v2 of this patch.  I had forgotten to update sql_features.txt. In your patch, the documentation says the definition is any_value("any") but the catalog definitions are any_value(anyelement). Please sort that out. Since the transition function is declared strict, null values don't need to be checked. I think the whole function could be reduced to Datum any_value_trans(PG_FUNCTION_ARGS) { PG_RETURN_DATUM(PG_GETARG_DATUM(0)); }