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 1pWdT5-0007lQ-B0 for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Feb 2023 13:23:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pWdT3-0001cw-LS for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Feb 2023 13:23:01 +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 1pWdT3-0001ca-Br for pgsql-hackers@lists.postgresql.org; Mon, 27 Feb 2023 13:23:01 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pWdT1-0004qS-0J for pgsql-hackers@postgresql.org; Mon, 27 Feb 2023 13:23:00 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 26EDF32002E8 for ; Mon, 27 Feb 2023 08:22:56 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 27 Feb 2023 08:22:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilmari.org; h=cc :content-type:date:date:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to; s=fm1; t= 1677504175; x=1677590575; bh=/rk2HGTvzZtVPsFBK0cjDL8Dg33gSfNJBOf NGoRfYzY=; b=EesoZUuYFgMG5S9txSeu4Ghz+g7cErHyWQjQL0P8Idmbv/7jati aBbEpE4032BcZrOZXfa1S/gi1HE5QcxNjx0FclLC/yTBv/1SDBMEo7zkhWzHS54x 87MzdWRFnzIF9r643v18z4S7XdV3JCZKd0rCQuhkm93gCngyXoh5dTCs/kK/5Sgx 5Aht848bVCK/kqXIN0NIlb0fVyWpL2EngKV79iG9yWhs2vMNazAnpt8qa4jn814Y qYM1xQtnAufvAK9WgskgRQa3+EMdibpMPnFCzCTm8p4U1ilrn71fdUzUv+Y3bs/f ylYtT+4N4bUyYI3++o/cLdU5N6t0CitNBmQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:message-id:mime-version :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1677504175; x= 1677590575; bh=/rk2HGTvzZtVPsFBK0cjDL8Dg33gSfNJBOfNGoRfYzY=; b=g /1KdeBa1UCzGCgxXwdTWJmv3R5ZvJrYKZLtc2XOvM5WbF0RtkoOXoxUk4SE6/HSh 2iQrdjOo1oXsnUH87PcgmRjbZNNm7jLzJ75vG4Qa0Qa3iNduMmqS8a4q5kkiEZGd 1GzV87SgEyF0vlialBXuox7P1XX4AFYYzhnjbdGPCfZVQ/mtVfeqw/SslKPTdBa/ RuAd7afsblFDo6htS/DSqVfqBv0+a1b5ZZtAMYrfXT8vmSebhNwqn6mUSWDEZQsq 3ToRjzKQHzU66ycfZm1WTPiaMZhc4KYk9d1qyM1yQUHo1FwyeBjy/PpGv6C/fYeW uwFWgdZcZxpDV0QHQOLaw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudeltddggeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkfgggtgesmhdtreertd erjeenucfhrhhomhepffgrghhfihhnnhcukfhlmhgrrhhiucforghnnhhsnohkvghruceo ihhlmhgrrhhisehilhhmrghrihdrohhrgheqnecuggftrfgrthhtvghrnhepieeiveetvd euveevkeefueejieekgfdvtdetffekgeejtedvjeetheehueeliedvnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihhlmhgrrhhisehilhhmrg hrihdrohhrgh X-ME-Proxy: Feedback-ID: i1ff147bf:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Mon, 27 Feb 2023 08:22:55 -0500 (EST) From: =?utf-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= To: pgsql-hackers@postgresql.org Subject: Adding argument names to aggregate functions Date: Mon, 27 Feb 2023 13:22:53 +0000 Message-ID: <877cw3jl8y.fsf@wibble.ilmari.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --=-=-= Content-Type: text/plain Hi hackers, I'm sure I'm not the only one who can never remember which way around the value and delimiter arguments go for string_agg() and has to look it up in the manual every time. To make it more convenient, here's a patch that adds proargnames to its pg_proc entries so that it can be seen with a quick \df in psql. I also added names to json(b)_object_agg() for good measure, even though they're more obvious. The remaining built-in multi-argument aggregate functions are the stats-related ones, where it's all just Y/X (but why in that order?), so I didn't think it was necessary. If others feel more strongly, I can add those too. - ilmari --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Add-argument-names-to-multi-argument-aggregates.patch From 73f323d5e97dca2e2452f5be199864a8358559c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= Date: Mon, 27 Feb 2023 13:06:29 +0000 Subject: [PATCH] Add argument names to multi-argument aggregates This makes it easier to see which way around the arguments go when using \dfa. This is particularly relevant for string_agg(), but add it to json(b)_object_agg() too for good measure. --- src/include/catalog/pg_proc.dat | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat index e2a7642a2b..f96d29278f 100644 --- a/src/include/catalog/pg_proc.dat +++ b/src/include/catalog/pg_proc.dat @@ -4988,6 +4988,7 @@ { oid => '3538', descr => 'concatenate aggregate input into a string', proname => 'string_agg', prokind => 'a', proisstrict => 'f', prorettype => 'text', proargtypes => 'text text', + proargnames => '{value,delimiter}', prosrc => 'aggregate_dummy' }, { oid => '3543', descr => 'aggregate transition function', proname => 'bytea_string_agg_transfn', proisstrict => 'f', @@ -5000,6 +5001,7 @@ { oid => '3545', descr => 'concatenate aggregate input into a bytea', proname => 'string_agg', prokind => 'a', proisstrict => 'f', prorettype => 'bytea', proargtypes => 'bytea bytea', + proargnames => '{value,delimiter}', prosrc => 'aggregate_dummy' }, # To ASCII conversion @@ -8899,6 +8901,7 @@ { oid => '3197', descr => 'aggregate input into a json object', proname => 'json_object_agg', prokind => 'a', proisstrict => 'f', provolatile => 's', prorettype => 'json', proargtypes => 'any any', + proargnames => '{key,value}', prosrc => 'aggregate_dummy' }, { oid => '3198', descr => 'build a json array from any inputs', proname => 'json_build_array', provariadic => 'any', proisstrict => 'f', @@ -9791,6 +9794,7 @@ { oid => '3270', descr => 'aggregate inputs into jsonb object', proname => 'jsonb_object_agg', prokind => 'a', proisstrict => 'f', prorettype => 'jsonb', proargtypes => 'any any', + proargnames => '{key,value}', prosrc => 'aggregate_dummy' }, { oid => '3271', descr => 'build a jsonb array from any inputs', proname => 'jsonb_build_array', provariadic => 'any', proisstrict => 'f', -- 2.39.1 --=-=-=--