mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
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.
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user