From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Getting rid of aggregate_dummy() |
Date: | 2020-11-01 20:47:45 |
Message-ID: | 533989.1604263665@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
While fooling with Gen_fmgrtab.pl for a nearby patch [1], I noticed
that fmgrtab.c had a lot of entries pointing at aggregate_dummy,
which seemed rather useless. So I experimented with removing them.
It turns out that nodeWindowAgg.c is carelessly expecting them to be
there, because it does fmgr_info_cxt() on the target window function
even if it will never call it because it's a plain aggregate.
But that's pretty trivial to fix, just need to relocate that call.
With that, we don't actually need aggregate_dummy() to exist at
all, because it's never referenced. Having "aggregate_dummy"
as the prosrc value for an aggregate function is now just a
random convention; any other string would do as well. (We could
save a few bytes in pg_proc by choosing a shorter string, but
probably it's better to stick to the existing convention.)
Anyway, this saves about 3KB in fmgrtab.o, without any downside
that I can see. If someone accidentally called an aggregate as
a normal function, they'd now get a different error message,
namely "internal function "aggregate_dummy" is not in internal lookup
table" instead of "aggregate function NNN called as normal function".
That doesn't really seem like a problem.
The attached patch is a delta over the one in [1].
regards, tom lane
[1] https://www.postgresql.org/message-id/472274.1604258384%40sss.pgh.pa.us
Attachment | Content-Type | Size |
---|---|---|
remove-aggregate_dummy.patch | text/x-diff | 4.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Gustafsson | 2020-11-01 22:04:18 | Re: Support for NSS as a libpq TLS backend |
Previous Message | Tom Lane | 2020-11-01 19:19:44 | Getting Gen_fmgrtab.pl to generate macros for all pg_proc entries |