aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/functions.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-08-02 01:30:51 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-08-02 01:30:51 +0000
commitf622c5404905cb998adabe3a3527f7e9cdace229 (patch)
treebc65d3f7d71a9a8c09945e7072bbca2baeb937a3 /src/backend/executor/functions.c
parent410b1dfb885f5b6d60f89003baba32a4efe93225 (diff)
downloadpostgresql-f622c5404905cb998adabe3a3527f7e9cdace229.tar.gz
postgresql-f622c5404905cb998adabe3a3527f7e9cdace229.zip
Allow DECLARE CURSOR to take parameters from the portal in which it is
executed. Previously, the DECLARE would succeed but subsequent FETCHes would fail since the parameter values supplied to DECLARE were not propagated to the portal created for the cursor. In support of this, add type Oids to ParamListInfo entries, which seems like a good idea anyway since code that extracts a value can double-check that it got the type of value it was expecting. Oliver Jowett, with minor editorialization by Tom Lane.
Diffstat (limited to 'src/backend/executor/functions.c')
-rw-r--r--src/backend/executor/functions.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index 0073f8f55c1..cfcccb6169e 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.83 2004/07/15 13:51:38 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.84 2004/08/02 01:30:41 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -58,6 +58,7 @@ typedef struct local_es
*/
typedef struct
{
+ Oid *argtypes; /* resolved types of arguments */
Oid rettype; /* actual return type */
int typlen; /* length of the return type */
bool typbyval; /* true if return type is pass by value */
@@ -223,6 +224,7 @@ init_sql_fcache(FmgrInfo *finfo)
}
else
argOidVect = NULL;
+ fcache->argtypes = argOidVect;
tmp = SysCacheGetAttr(PROCOID,
procedureTuple,
@@ -283,7 +285,8 @@ postquel_getnext(execution_state *es)
if (es->qd->operation == CMD_UTILITY)
{
- ProcessUtility(es->qd->parsetree->utilityStmt, es->qd->dest, NULL);
+ ProcessUtility(es->qd->parsetree->utilityStmt, es->qd->params,
+ es->qd->dest, NULL);
return NULL;
}
@@ -332,6 +335,7 @@ postquel_sub_params(SQLFunctionCachePtr fcache,
{
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];
}