diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-07-16 16:55:24 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-07-16 16:55:24 +0000 |
commit | 6563e9e2e8b15350e4cb99b86f2f7dec54722155 (patch) | |
tree | 312342db5f13289768a09d3dca49fc1bf9c2b0da /src/backend/utils/adt/ruleutils.c | |
parent | 895a4bccb6663ad04b02905fcbf128e64d30abd9 (diff) | |
download | postgresql-6563e9e2e8b15350e4cb99b86f2f7dec54722155.tar.gz postgresql-6563e9e2e8b15350e4cb99b86f2f7dec54722155.zip |
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.
Diffstat (limited to 'src/backend/utils/adt/ruleutils.c')
-rw-r--r-- | src/backend/utils/adt/ruleutils.c | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index dc4a6cc4a8f..c7f896c524a 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -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); |