aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/functions.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-04-22 01:26:01 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-04-22 01:26:01 +0000
commit2206b498d8240447a9353ce4e994ba41a8e307ac (patch)
treeeb60585d0dae556ae45aae35a7d50f83be715ab4 /src/backend/executor/functions.c
parent0606860a20511c41d5c9074831e6328547722537 (diff)
downloadpostgresql-2206b498d8240447a9353ce4e994ba41a8e307ac.tar.gz
postgresql-2206b498d8240447a9353ce4e994ba41a8e307ac.zip
Simplify ParamListInfo data structure to support only numbered parameters,
not named ones, and replace linear searches of the list with array indexing. The named-parameter support has been dead code for many years anyway, and recent profiling suggests that the searching was costing a noticeable amount of performance for complex queries.
Diffstat (limited to 'src/backend/executor/functions.c')
-rw-r--r--src/backend/executor/functions.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index 0fc4d7b59b2..92e43c1dc57 100644
--- a/src/backend/executor/functions.c
+++ b/src/backend/executor/functions.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.101 2006/03/05 15:58:26 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.102 2006/04/22 01:25:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -431,17 +431,19 @@ postquel_sub_params(SQLFunctionCachePtr fcache,
{
int i;
- paramLI = (ParamListInfo) palloc0((nargs + 1) * sizeof(ParamListInfoData));
+ /* sizeof(ParamListInfoData) includes the first array element */
+ paramLI = (ParamListInfo) palloc(sizeof(ParamListInfoData) +
+ (nargs - 1) * sizeof(ParamExternData));
+ paramLI->numParams = nargs;
for (i = 0; i < nargs; i++)
{
- paramLI[i].kind = PARAM_NUM;
- paramLI[i].id = i + 1;
- paramLI[i].ptype = fcache->argtypes[i];
- paramLI[i].value = fcinfo->arg[i];
- paramLI[i].isnull = fcinfo->argnull[i];
+ ParamExternData *prm = &paramLI->params[i];
+
+ prm->value = fcinfo->arg[i];
+ prm->isnull = fcinfo->argnull[i];
+ prm->ptype = fcache->argtypes[i];
}
- paramLI[nargs].kind = PARAM_INVALID;
}
else
paramLI = NULL;