mirror of
https://github.com/postgres/postgres.git
synced 2025-10-16 17:07:43 +03:00
Add a "provariadic" column to pg_proc to eliminate the remarkably expensive
need to deconstruct proargmodes for each pg_proc entry inspected by FuncnameGetCandidates(). Fixes function lookup performance regression caused by yesterday's variadic-functions patch. In passing, make pg_proc.probin be NULL, rather than a dummy value '-', in cases where it is not actually used for the particular type of function. This should buy back some of the space cost of the extra column.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.276 2008/07/16 01:30:22 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.277 2008/07/16 16:55:23 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -5389,29 +5389,12 @@ generate_function_name(Oid funcid, int nargs, Oid *argtypes,
|
||||
/* Check variadic-ness if caller cares */
|
||||
if (is_variadic)
|
||||
{
|
||||
/* XXX change this if we simplify code in FuncnameGetCandidates */
|
||||
Datum proargmodes;
|
||||
bool isnull;
|
||||
|
||||
*is_variadic = false;
|
||||
|
||||
proargmodes = SysCacheGetAttr(PROCOID, proctup,
|
||||
Anum_pg_proc_proargmodes, &isnull);
|
||||
if (!isnull)
|
||||
{
|
||||
ArrayType *ar = DatumGetArrayTypeP(proargmodes);
|
||||
char *argmodes;
|
||||
int j;
|
||||
|
||||
argmodes = ARR_DATA_PTR(ar);
|
||||
j = ARR_DIMS(ar)[0] - 1;
|
||||
if (j >= 0 && argmodes[j] == PROARGMODE_VARIADIC)
|
||||
{
|
||||
/* "any" variadics are not treated as variadics for listing */
|
||||
if (procform->proargtypes.values[j] != ANYOID)
|
||||
*is_variadic = true;
|
||||
}
|
||||
}
|
||||
/* "any" variadics are not treated as variadics for listing */
|
||||
if (OidIsValid(procform->provariadic) &&
|
||||
procform->provariadic != ANYOID)
|
||||
*is_variadic = true;
|
||||
else
|
||||
*is_variadic = false;
|
||||
}
|
||||
|
||||
ReleaseSysCache(proctup);
|
||||
|
Reference in New Issue
Block a user