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 1pnGHu-0000th-Q1 for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Apr 2023 10:04:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pnGGv-0003eQ-AA for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Apr 2023 10:03:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pnGGu-0003eG-W2 for pgsql-hackers@lists.postgresql.org; Fri, 14 Apr 2023 10:03:13 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pnGGr-002pRE-8L for pgsql-hackers@postgresql.org; Fri, 14 Apr 2023 10:03:12 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 8D93B3200805; Fri, 14 Apr 2023 06:03:06 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 14 Apr 2023 06:03:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilmari.org; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1681466586; x=1681552986; bh=AT jauLX14oQ7ojqnJt+UFfmm5A2JbBF9FiqdNeWtD8Q=; b=a1aOQIHvfmVPqyCVBS Dv91fhNpd/fmpeIfkC/nVGzZPQrWglz0e/XWOJLky6i+6H+fQsZSeS17HcCkSf/0 5PYzqnRC6OkBRYtEonWYJ+d5blcbW7fJMbD/W6vJL3G1LgIr1m8V1MArCcaFUt8A zuxPsWHH0mL1b/pVDPWOSSoY+AhIFoDSOzUQBt8Q16sKtfdlL+tesYC9/bEJDu4a myWs82ExiixnX0Yf6WspKJOGX6qjUwHwvnTuUP6AULC2b356Hd9VfBJ6B3K9SlxH 77d7TTZ8Mt62yobcxV3kPTzJ2OvLeD4IcUssq0X562M+bQZ2RCKhela2gJ5fPXqH npdA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type: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=1681466586; x=1681552986; bh=ATjauLX14oQ7o jqnJt+UFfmm5A2JbBF9FiqdNeWtD8Q=; b=I24Tv6sUdLNU4kOAP0D4bilFOeS4I 1V+r5gh8hGUxTcirB0Qiah7Z0UZUquiUzwjUzzPYhDgxHIMwyTe+k9B+cZKZ3PKN cOjmaAj0/4S3PHWAfTxNqxoeOASbVcMbZN8pikb1iKyvvsR55mYG0H2WLC+6k2uz zaCkLvg1+mR3I7pcwbnFjnLAnI3E1jdgeJszB7WxWp80edvQok3lH6U51omyy5LI y4eZOV9f1xObSqoWKMXk0oA5Zyo7BkZ/Xytg0d3N0mNHNdKt8BY7Wq5Y+W53BYOm Gh1Loq4qjF62oTq0xyqZLDiq3mAlPbt5vdrN16jJ49PFvzHdtYuZvrdNQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeltddgvddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufhffjgfkfgggtgesmhdtreertderjeenucfhrhhomhepffgrghhf ihhnnhcukfhlmhgrrhhiucforghnnhhsnohkvghruceoihhlmhgrrhhisehilhhmrghrih drohhrgheqnecuggftrfgrthhtvghrnhepiedtkefgudetieefgeeuueeiffejtdehleev vdejvdelffevuedtvefffefgiedvnecuffhomhgrihhnpehpohhsthhgrhgvshhqlhdroh hrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehi lhhmrghrihesihhlmhgrrhhirdhorhhg X-ME-Proxy: Feedback-ID: i1ff147bf:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 14 Apr 2023 06:03:05 -0400 (EDT) From: =?utf-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= To: Jim Jones Cc: pgsql-hackers@postgresql.org Subject: Re: Adding argument names to aggregate functions References: <877cw3jl8y.fsf@wibble.ilmari.org> <87wn2hq959.fsf@wibble.ilmari.org> <16f35a27-ad65-0420-44ee-b41c3fd08aee@uni-muenster.de> Date: Fri, 14 Apr 2023 11:03:03 +0100 In-Reply-To: <16f35a27-ad65-0420-44ee-b41c3fd08aee@uni-muenster.de> (Jim Jones's message of "Fri, 14 Apr 2023 11:12:24 +0200") Message-ID: <87mt3ardbc.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; charset=utf-8 Content-Transfer-Encoding: 8bit Jim Jones writes: > On 12.04.23 19:53, Dagfinn Ilmari Mannsåker wrote: >> Dagfinn Ilmari Mannsåker writes: >> >>> 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. >> Added to the 2023-07 commitfest: >> >> https://commitfest.postgresql.org/43/4275/ >> >> - ilmari > > +1 for adding the argument names. > > The patch needs a rebase though.. it no longer applies : > > $ git apply > ~/Downloads/0001-Add-argument-names-to-multi-argument-aggregates.patch > error: patch failed: src/include/catalog/pg_proc.dat:8899 > error: src/include/catalog/pg_proc.dat: patch does not apply Thanks for the heads-up, here's a rebased patch. I've also formatted the lines to match what reformat_dat_file.pl wants. It also wanted to reformat a bunch of other entries, but I left those alone. - ilmari --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v2-0001-Add-argument-names-to-multi-argument-aggregates.patch From a6ff997fcea7aa7201318cb94db0173ea6efdf02 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: [RFC PATCH v2] 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 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat index b516cee8bd..b2db8d07e1 100644 --- a/src/include/catalog/pg_proc.dat +++ b/src/include/catalog/pg_proc.dat @@ -5017,7 +5017,7 @@ { oid => '3538', descr => 'concatenate aggregate input into a string', proname => 'string_agg', prokind => 'a', proisstrict => 'f', prorettype => 'text', proargtypes => 'text text', - prosrc => 'aggregate_dummy' }, + proargnames => '{value,delimiter}', prosrc => 'aggregate_dummy' }, { oid => '3543', descr => 'aggregate transition function', proname => 'bytea_string_agg_transfn', proisstrict => 'f', prorettype => 'internal', proargtypes => 'internal bytea bytea', @@ -5029,7 +5029,7 @@ { oid => '3545', descr => 'concatenate aggregate input into a bytea', proname => 'string_agg', prokind => 'a', proisstrict => 'f', prorettype => 'bytea', proargtypes => 'bytea bytea', - prosrc => 'aggregate_dummy' }, + proargnames => '{value,delimiter}', prosrc => 'aggregate_dummy' }, # To ASCII conversion { oid => '1845', descr => 'encode text from DB encoding to ASCII text', @@ -8978,7 +8978,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', - prosrc => 'aggregate_dummy' }, + proargnames => '{key,value}', prosrc => 'aggregate_dummy' }, { oid => '8955', descr => 'aggregate non-NULL input into a json object', proname => 'json_object_agg_strict', prokind => 'a', proisstrict => 'f', provolatile => 's', prorettype => 'json', proargtypes => 'any any', @@ -9906,7 +9906,7 @@ prosrc => 'jsonb_object_agg_finalfn' }, { oid => '3270', descr => 'aggregate inputs into jsonb object', proname => 'jsonb_object_agg', prokind => 'a', proisstrict => 'f', - prorettype => 'jsonb', proargtypes => 'any any', + prorettype => 'jsonb', proargtypes => 'any any', proargnames => '{key,value}', prosrc => 'aggregate_dummy' }, { oid => '8963', descr => 'aggregate non-NULL inputs into jsonb object', proname => 'jsonb_object_agg_strict', prokind => 'a', proisstrict => 'f', -- 2.39.2 --=-=-=--