| Lists: | pgsql-hackers |
|---|
| From: | Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org> |
|---|---|
| To: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Adding argument names to aggregate functions |
| Date: | 2023-02-27 13:22:53 |
| Message-ID: | 877cw3jl8y.fsf@wibble.ilmari.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
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
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Add-argument-names-to-multi-argument-aggregates.patch | text/x-diff | 2.2 KB |
| From: | Vik Fearing <vik(at)postgresfriends(dot)org> |
|---|---|
| To: | Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Adding argument names to aggregate functions |
| Date: | 2023-02-27 23:38:21 |
| Message-ID: | 3c173b2c-4a12-d398-6bf1-c48080541a42@postgresfriends.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
On 2/27/23 14:22, Dagfinn Ilmari Mannsåker wrote:
> 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.
No comment on adding names for everything, but a big +1 for the ones
included here.
--
Vik Fearing
| From: | Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org> |
|---|---|
| To: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Adding argument names to aggregate functions |
| Date: | 2023-04-12 17:53:54 |
| Message-ID: | 87wn2hq959.fsf@wibble.ilmari.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)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
| From: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
|---|---|
| To: | Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Adding argument names to aggregate functions |
| Date: | 2023-04-14 09:12:24 |
| Message-ID: | 16f35a27-ad65-0420-44ee-b41c3fd08aee@uni-muenster.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
On 12.04.23 19:53, Dagfinn Ilmari Mannsåker wrote:
> Dagfinn Ilmari Mannsåker<ilmari(at)ilmari(dot)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
Jim
| From: | Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org> |
|---|---|
| To: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
| Cc: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Adding argument names to aggregate functions |
| Date: | 2023-04-14 10:03:03 |
| Message-ID: | 87mt3ardbc.fsf@wibble.ilmari.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> writes:
> On 12.04.23 19:53, Dagfinn Ilmari Mannsåker wrote:
>> Dagfinn Ilmari Mannsåker<ilmari(at)ilmari(dot)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
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0001-Add-argument-names-to-multi-argument-aggregates.patch | text/x-diff | 2.7 KB |
| From: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
|---|---|
| To: | Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org> |
| Cc: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Adding argument names to aggregate functions |
| Date: | 2023-04-18 08:58:11 |
| Message-ID: | 54d1c9a9-6b16-2fb2-199e-ac903c88c4d2@uni-muenster.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
On 14.04.23 12:03, Dagfinn Ilmari Mannsåker wrote:
> 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
The patch applies cleanly now and \df shows the argument names:
postgres=# \df string_agg
List of functions
Schema | Name | Result data type | Argument data
types | Type
------------+------------+------------------+------------------------------+------
pg_catalog | string_agg | bytea | value bytea, delimiter
bytea | agg
pg_catalog | string_agg | text | value text, delimiter
text | agg
(2 rows)
postgres=# \df json_object_agg
List of functions
Schema | Name | Result data type | Argument data
types | Type
------------+-----------------+------------------+------------------------+------
pg_catalog | json_object_agg | json | key "any", value
"any" | agg
(1 row)
I'm wondering if there are some sort of guidelines that dictate when to
name an argument or not. It would be nice to have one for future reference.
I will mark the CF entry as "Read for Committer" and let the committers
decide if it's best to first create a guideline for that or not.
Best, Jim
| From: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
|---|---|
| To: | Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org> |
| Cc: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Adding argument names to aggregate functions |
| Date: | 2023-04-18 09:16:46 |
| Message-ID: | d36e168b-7a07-e010-43c1-4a040ec1296c@uni-muenster.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
On 18.04.23 10:58, I wrote:
> On 14.04.23 12:03, Dagfinn Ilmari Mannsåker wrote:
>> 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
>
> The patch applies cleanly now and \df shows the argument names:
>
> postgres=# \df string_agg
> List of functions
> Schema | Name | Result data type | Argument data
> types | Type
> ------------+------------+------------------+------------------------------+------
>
> pg_catalog | string_agg | bytea | value bytea, delimiter
> bytea | agg
> pg_catalog | string_agg | text | value text, delimiter
> text | agg
> (2 rows)
>
> postgres=# \df json_object_agg
> List of functions
> Schema | Name | Result data type | Argument data
> types | Type
> ------------+-----------------+------------------+------------------------+------
>
> pg_catalog | json_object_agg | json | key "any", value
> "any" | agg
> (1 row)
>
>
> I'm wondering if there are some sort of guidelines that dictate when
> to name an argument or not. It would be nice to have one for future
> reference.
>
> I will mark the CF entry as "Read for Committer" and let the
> committers decide if it's best to first create a guideline for that or
> not.
>
> Best, Jim
>
I just saw that the patch is failing[1] on "macOS - Ventura - Meson".
Not sure if it is related to this patch though ..
[1]
https://api.cirrus-ci.com/v1/artifact/task/5881376021413888/meson_log/build/meson-logs/meson-log.txt
| From: | Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org> |
|---|---|
| To: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
| Cc: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Adding argument names to aggregate functions |
| Date: | 2023-04-18 10:27:54 |
| Message-ID: | 87sfcxv61h.fsf@wibble.ilmari.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> writes:
> On 18.04.23 10:58, I wrote:
>> On 14.04.23 12:03, Dagfinn Ilmari Mannsåker wrote:
>>> 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
>>
>> The patch applies cleanly now and \df shows the argument names:
>>
>> postgres=# \df string_agg
>> List of functions
>> Schema | Name | Result data type | Argument data
>> types | Type
>> ------------+------------+------------------+------------------------------+------
>> pg_catalog | string_agg | bytea | value bytea, delimiter bytea | agg
>> pg_catalog | string_agg | text | value text, delimiter text | agg
>> (2 rows)
>>
>> postgres=# \df json_object_agg
>> List of functions
>> Schema | Name | Result data type | Argument data
>> types | Type
>> ------------+-----------------+------------------+------------------------+------
>> pg_catalog | json_object_agg | json | key "any", value "any" | agg
>> (1 row)
>>
>>
>> I'm wondering if there are some sort of guidelines that dictate when
>> to name an argument or not. It would be nice to have one for future
>> reference.
I seemed to recall a patch to add arugment names to a bunch of functions
in the past, thinking that might have some guidance, but can't for the
life of me find it now.
>> I will mark the CF entry as "Read for Committer" and let the
>> committers decide if it's best to first create a guideline for that or
>> not.
>>
>> Best, Jim
>>
> I just saw that the patch is failing[1] on "macOS - Ventura -
> Meson". Not sure if it is related to this patch though ..
>
> [1]
> https://api.cirrus-ci.com/v1/artifact/task/5881376021413888/meson_log/build/meson-logs/meson-log.txt
Link to the actual job:
https://cirrus-ci.com/task/5881376021413888
The failure was:
[09:54:38.727] 216/262 postgresql:recovery / recovery/031_recovery_conflict ERROR 198.73s exit status 60
Looking at its log:
we see:
timed out waiting for match: (?^:User was holding a relation lock for too long) at /Users/admin/pgsql/src/test/recovery/t/031_recovery_conflict.pl line 311.
That looks indeed completely unrelated to this patch.
- ilmari
| From: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
|---|---|
| To: | Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org> |
| Cc: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Adding argument names to aggregate functions |
| Date: | 2023-04-18 10:39:33 |
| Message-ID: | cd7c78aa-ec48-3e40-a7f9-edf77ff5742e@uni-muenster.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
On 18.04.23 12:27, Dagfinn Ilmari Mannsåker wrote:
> Link to the actual job:
> https://cirrus-ci.com/task/5881376021413888
>
> The failure was:
>
> [09:54:38.727] 216/262 postgresql:recovery / recovery/031_recovery_conflict ERROR 198.73s exit status 60
>
> Looking at its log:
>
> https://api.cirrus-ci.com/v1/artifact/task/5881376021413888/testrun/build/testrun/recovery/031_recovery_conflict/log/regress_log_031_recovery_conflict
>
> we see:
>
> timed out waiting for match: (?^:User was holding a relation lock for too long) at /Users/admin/pgsql/src/test/recovery/t/031_recovery_conflict.pl line 311.
>
> That looks indeed completely unrelated to this patch.
Yes, that's what I suspected. The patch passes all tests now :)
I've marked the CF entry as "Ready for Committer".
Jim
| From: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
|---|---|
| To: | Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org> |
| Cc: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Adding argument names to aggregate functions |
| Date: | 2023-07-19 07:56:29 |
| Message-ID: | DDD7D008-3CEC-446E-9F95-7C14A1118911@yesql.se |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
This patch no longer applied but had a fairly trivial conflict so I've attached
a rebased v3 addressing the conflict in the hopes of getting this further.
--
Daniel Gustafsson
| Attachment | Content-Type | Size |
|---|---|---|
| v3-0001-Add-argument-names-to-multi-argument-aggregates.patch | application/octet-stream | 2.9 KB |
| From: | Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org> |
|---|---|
| To: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
| Cc: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Adding argument names to aggregate functions |
| Date: | 2023-07-19 17:32:16 |
| Message-ID: | 87zg3rq02n.fsf@wibble.ilmari.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
Daniel Gustafsson <daniel(at)yesql(dot)se> writes:
> This patch no longer applied but had a fairly trivial conflict so I've attached
> a rebased v3 addressing the conflict in the hopes of getting this further.
Thanks for the heads-up! Turns out the conflict was due to the new
json(b)_object_agg(_unique)(_strict) functions, which should also have
proargnames added. Here's an updated patch that does that.
- ilmari
| Attachment | Content-Type | Size |
|---|---|---|
| v4-0001-Add-argument-names-to-multi-argument-aggregates.patch | text/x-diff | 4.7 KB |
| From: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
|---|---|
| To: | Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org> |
| Cc: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Adding argument names to aggregate functions |
| Date: | 2023-07-19 19:38:12 |
| Message-ID: | 98834F2E-B4E3-4084-8D81-4B3DD8D666E0@yesql.se |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
> On 19 Jul 2023, at 19:32, Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org> wrote:
>
> Daniel Gustafsson <daniel(at)yesql(dot)se> writes:
>
>> This patch no longer applied but had a fairly trivial conflict so I've attached
>> a rebased v3 addressing the conflict in the hopes of getting this further.
>
> Thanks for the heads-up! Turns out the conflict was due to the new
> json(b)_object_agg(_unique)(_strict) functions, which should also have
> proargnames added. Here's an updated patch that does that.
Great, thanks! I had a quick look at this while rebasing (as well as your
updated patch) and it seems like a good idea to add this. Unless there are
objections I will look at getting this in.
--
Daniel Gustafsson
| From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
|---|---|
| To: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
| Cc: | Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>, Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Adding argument names to aggregate functions |
| Date: | 2023-08-03 23:36:01 |
| Message-ID: | 20230803233601.GB1238296@nathanxps13 |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
On Wed, Jul 19, 2023 at 09:38:12PM +0200, Daniel Gustafsson wrote:
> Great, thanks! I had a quick look at this while rebasing (as well as your
> updated patch) and it seems like a good idea to add this. Unless there are
> objections I will look at getting this in.
Hey Daniel, are you still planning on committing this? I can pick it up if
you are busy.
--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com
| From: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
|---|---|
| To: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
| Cc: | Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>, Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Adding argument names to aggregate functions |
| Date: | 2023-08-24 10:05:17 |
| Message-ID: | D1BE0384-2B32-44E4-852B-652F9021FEE7@yesql.se |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
> On 4 Aug 2023, at 01:36, Nathan Bossart <nathandbossart(at)gmail(dot)com> wrote:
>
> On Wed, Jul 19, 2023 at 09:38:12PM +0200, Daniel Gustafsson wrote:
>> Great, thanks! I had a quick look at this while rebasing (as well as your
>> updated patch) and it seems like a good idea to add this. Unless there are
>> objections I will look at getting this in.
>
> Hey Daniel, are you still planning on committing this? I can pick it up if
> you are busy.
Finally unburied this from the post-vacation pile on the TODO list and pushed
it after another once-over.
--
Daniel Gustafsson
| From: | Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org> |
|---|---|
| To: | "Daniel Gustafsson" <daniel(at)yesql(dot)se>, "Nathan Bossart" <nathandbossart(at)gmail(dot)com> |
| Cc: | "Jim Jones" <jim(dot)jones(at)uni-muenster(dot)de>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Adding argument names to aggregate functions |
| Date: | 2023-08-24 12:38:59 |
| Message-ID: | 086c0f1f-febf-4091-ab61-87407ca39eb1@app.fastmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
On Thu, 24 Aug 2023, at 11:05, Daniel Gustafsson wrote:
>> On 4 Aug 2023, at 01:36, Nathan Bossart <nathandbossart(at)gmail(dot)com> wrote:
>>
>> On Wed, Jul 19, 2023 at 09:38:12PM +0200, Daniel Gustafsson wrote:
>>> Great, thanks! I had a quick look at this while rebasing (as well as your
>>> updated patch) and it seems like a good idea to add this. Unless there are
>>> objections I will look at getting this in.
>>
>> Hey Daniel, are you still planning on committing this? I can pick it up if
>> you are busy.
>
> Finally unburied this from the post-vacation pile on the TODO list and pushed
> it after another once-over.
Thanks!
--
- ilmari