diff options
| author | Tom Lane | 2004-08-02 01:30:51 +0000 |
|---|---|---|
| committer | Tom Lane | 2004-08-02 01:30:51 +0000 |
| commit | f622c5404905cb998adabe3a3527f7e9cdace229 (patch) | |
| tree | bc65d3f7d71a9a8c09945e7072bbca2baeb937a3 /src/pl | |
| parent | 410b1dfb885f5b6d60f89003baba32a4efe93225 (diff) | |
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/pl')
| -rw-r--r-- | src/pl/plpgsql/src/pl_exec.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c index f075b96c0fc..124d3c4bad2 100644 --- a/src/pl/plpgsql/src/pl_exec.c +++ b/src/pl/plpgsql/src/pl_exec.c @@ -3,7 +3,7 @@ * procedural language * * IDENTIFICATION - * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.112 2004/08/01 17:32:21 tgl Exp $ + * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.113 2004/08/02 01:30:49 tgl Exp $ * * This software is copyrighted by Jan Wieck - Hamburg. * @@ -3582,7 +3582,7 @@ exec_eval_simple_expr(PLpgSQL_execstate * estate, * need to have more than one active param list. */ paramLI = (ParamListInfo) - MemoryContextAlloc(econtext->ecxt_per_tuple_memory, + MemoryContextAllocZero(econtext->ecxt_per_tuple_memory, (expr->nparams + 1) * sizeof(ParamListInfoData)); /* @@ -3591,12 +3591,11 @@ exec_eval_simple_expr(PLpgSQL_execstate * estate, for (i = 0; i < expr->nparams; i++) { PLpgSQL_datum *datum = estate->datums[expr->params[i]]; - Oid paramtypeid; paramLI[i].kind = PARAM_NUM; paramLI[i].id = i + 1; exec_eval_datum(estate, datum, expr->plan_argtypes[i], - ¶mtypeid, + ¶mLI[i].ptype, ¶mLI[i].value, ¶mLI[i].isnull); } paramLI[i].kind = PARAM_INVALID; |
