pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feedFrom: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
To: Jim Jones <jim.jones@uni-muenster.de>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Adding argument names to aggregate functions
Date: Fri, 14 Apr 2023 11:03:03 +0100
Message-ID: <87mt3ardbc.fsf@wibble.ilmari.org> (raw)
In-Reply-To: <16f35a27-ad65-0420-44ee-b41c3fd08aee@uni-muenster.de>
References: <877cw3jl8y.fsf@wibble.ilmari.org>
<87wn2hq959.fsf@wibble.ilmari.org>
<16f35a27-ad65-0420-44ee-b41c3fd08aee@uni-muenster.de>
Jim Jones <jim.jones@uni-muenster.de> writes:
> On 12.04.23 19:53, Dagfinn Ilmari Mannsåker wrote:
>> Dagfinn Ilmari Mannsåker<ilmari@ilmari.org> 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
Attachments:
[text/x-diff] v2-0001-Add-argument-names-to-multi-argument-aggregates.patch (2.7K, ../87mt3ardbc.fsf@wibble.ilmari.org/2-v2-0001-Add-argument-names-to-multi-argument-aggregates.patch)
download | inline diff:
From a6ff997fcea7aa7201318cb94db0173ea6efdf02 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <ilmari@ilmari.org>
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
view thread (15+ messages) latest in thread
Message-ID: <87mt3ardbc.fsf@wibble.ilmari.org>
Permalink: ../87mt3ardbc.fsf@wibble.ilmari.org/
Also on: postgresql.org/message-id/87mt3ardbc.fsf@wibble.ilmari.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: ilmari@ilmari.org, jim.jones@uni-muenster.de
Subject: Re: Adding argument names to aggregate functions
In-Reply-To: <87mt3ardbc.fsf@wibble.ilmari.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox