mirror of
https://github.com/postgres/postgres.git
synced 2025-04-20 00:42:27 +03:00
Back-patch critical fixes for NUMERIC values in plpgsql functions.
This commit is contained in:
parent
8d018f9db8
commit
21f0db98ea
@ -3,7 +3,7 @@
|
|||||||
* procedural language
|
* procedural language
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.12 1999/07/04 01:03:01 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.12.2.1 2000/01/16 00:45:33 tgl Exp $
|
||||||
*
|
*
|
||||||
* This software is copyrighted by Jan Wieck - Hamburg.
|
* This software is copyrighted by Jan Wieck - Hamburg.
|
||||||
*
|
*
|
||||||
@ -130,7 +130,7 @@ static void exec_move_row(PLpgSQL_execstate * estate,
|
|||||||
static Datum exec_cast_value(Datum value, Oid valtype,
|
static Datum exec_cast_value(Datum value, Oid valtype,
|
||||||
Oid reqtype,
|
Oid reqtype,
|
||||||
FmgrInfo *reqinput,
|
FmgrInfo *reqinput,
|
||||||
int16 reqtypmod,
|
int32 reqtypmod,
|
||||||
bool *isnull);
|
bool *isnull);
|
||||||
static void exec_set_found(PLpgSQL_execstate * estate, bool state);
|
static void exec_set_found(PLpgSQL_execstate * estate, bool state);
|
||||||
|
|
||||||
@ -1561,7 +1561,7 @@ exec_stmt_raise(PLpgSQL_execstate * estate, PLpgSQL_stmt_raise * stmt)
|
|||||||
typeStruct = (Form_pg_type) GETSTRUCT(typetup);
|
typeStruct = (Form_pg_type) GETSTRUCT(typetup);
|
||||||
|
|
||||||
fmgr_info(typeStruct->typoutput, &finfo_output);
|
fmgr_info(typeStruct->typoutput, &finfo_output);
|
||||||
extval = (char *) (*fmgr_faddr(&finfo_output)) (var->value, &(var->isnull), var->datatype->atttypmod);
|
extval = (char *) (*fmgr_faddr(&finfo_output)) (var->value, InvalidOid, var->datatype->atttypmod);
|
||||||
}
|
}
|
||||||
plpgsql_dstring_append(&ds, extval);
|
plpgsql_dstring_append(&ds, extval);
|
||||||
break;
|
break;
|
||||||
@ -1874,7 +1874,7 @@ exec_assign_value(PLpgSQL_execstate * estate,
|
|||||||
char *nulls;
|
char *nulls;
|
||||||
bool attisnull;
|
bool attisnull;
|
||||||
Oid atttype;
|
Oid atttype;
|
||||||
int4 atttypmod;
|
int32 atttypmod;
|
||||||
HeapTuple typetup;
|
HeapTuple typetup;
|
||||||
Form_pg_type typeStruct;
|
Form_pg_type typeStruct;
|
||||||
FmgrInfo finfo_input;
|
FmgrInfo finfo_input;
|
||||||
@ -2373,7 +2373,7 @@ static Datum
|
|||||||
exec_cast_value(Datum value, Oid valtype,
|
exec_cast_value(Datum value, Oid valtype,
|
||||||
Oid reqtype,
|
Oid reqtype,
|
||||||
FmgrInfo *reqinput,
|
FmgrInfo *reqinput,
|
||||||
int16 reqtypmod,
|
int32 reqtypmod,
|
||||||
bool *isnull)
|
bool *isnull)
|
||||||
{
|
{
|
||||||
if (!*isnull)
|
if (!*isnull)
|
||||||
@ -2383,7 +2383,7 @@ exec_cast_value(Datum value, Oid valtype,
|
|||||||
* that of the variable, convert it.
|
* that of the variable, convert it.
|
||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
if (valtype != reqtype || reqtypmod > 0)
|
if (valtype != reqtype || reqtypmod != -1)
|
||||||
{
|
{
|
||||||
HeapTuple typetup;
|
HeapTuple typetup;
|
||||||
Form_pg_type typeStruct;
|
Form_pg_type typeStruct;
|
||||||
@ -2397,8 +2397,8 @@ exec_cast_value(Datum value, Oid valtype,
|
|||||||
typeStruct = (Form_pg_type) GETSTRUCT(typetup);
|
typeStruct = (Form_pg_type) GETSTRUCT(typetup);
|
||||||
|
|
||||||
fmgr_info(typeStruct->typoutput, &finfo_output);
|
fmgr_info(typeStruct->typoutput, &finfo_output);
|
||||||
extval = (char *) (*fmgr_faddr(&finfo_output)) (value, &isnull, -1);
|
extval = (char *) (*fmgr_faddr(&finfo_output)) (value, InvalidOid, -1);
|
||||||
value = (Datum) (*fmgr_faddr(reqinput)) (extval, &isnull, reqtypmod);
|
value = (Datum) (*fmgr_faddr(reqinput)) (extval, InvalidOid, reqtypmod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* procedural language
|
* procedural language
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.3 1999/01/27 16:15:22 wieck Exp $
|
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.3.2.1 2000/01/16 00:45:33 tgl Exp $
|
||||||
*
|
*
|
||||||
* This software is copyrighted by Jan Wieck - Hamburg.
|
* This software is copyrighted by Jan Wieck - Hamburg.
|
||||||
*
|
*
|
||||||
@ -126,7 +126,7 @@ typedef struct
|
|||||||
Oid typoid;
|
Oid typoid;
|
||||||
FmgrInfo typinput;
|
FmgrInfo typinput;
|
||||||
bool typbyval;
|
bool typbyval;
|
||||||
int16 atttypmod;
|
int32 atttypmod;
|
||||||
} PLpgSQL_type;
|
} PLpgSQL_type;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user