mirror of
https://github.com/postgres/postgres.git
synced 2025-08-24 09:27:52 +03:00
Remove useless entries for aggregate functions from fmgrtab.c.
Gen_fmgrtab.pl treated aggregate functions the same as other built-in functions, which is wasteful because there is no real need to have entries for them in the fmgr_builtins[] table. Suppressing those entries saves about 3KB in the compiled table on my machine; which is not a lot but it's not nothing either, considering that that table is pretty "hot". The only outside code change needed is that ExecInitWindowAgg() can't be allowed to call fmgr_info_cxt() on a plain aggregate function. But that saves a few cycles anyway. Having done that, the aggregate_dummy() function is unreferenced and might as well be dropped. Using "aggregate_dummy" as the prosrc value for an aggregate is now just a documentation convention not something that matters. There was some discussion of using NULL instead to save a few bytes in pg_proc, but we'd have to remove prosrc's BKI_FORCE_NOT_NULL marking which doesn't seem a great idea. Anyway, it's possible there's client-side code that expects to see "aggregate_dummy" there, so I'm loath to change it without a strong reason. Discussion: https://postgr.es/m/533989.1604263665@sss.pgh.pa.us
This commit is contained in:
@@ -4935,24 +4935,6 @@ AggRegisterCallback(FunctionCallInfo fcinfo,
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* aggregate_dummy - dummy execution routine for aggregate functions
|
||||
*
|
||||
* This function is listed as the implementation (prosrc field) of pg_proc
|
||||
* entries for aggregate functions. Its only purpose is to throw an error
|
||||
* if someone mistakenly executes such a function in the normal way.
|
||||
*
|
||||
* Perhaps someday we could assign real meaning to the prosrc field of
|
||||
* an aggregate?
|
||||
*/
|
||||
Datum
|
||||
aggregate_dummy(PG_FUNCTION_ARGS)
|
||||
{
|
||||
elog(ERROR, "aggregate function %u called as normal function",
|
||||
fcinfo->flinfo->fn_oid);
|
||||
return (Datum) 0; /* keep compiler quiet */
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* Parallel Query Support
|
||||
* ----------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user