Skip to content

Commit 21f0db9

Browse files
committed
Back-patch critical fixes for NUMERIC values in plpgsql functions.
1 parent 8d018f9 commit 21f0db9

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/pl/plpgsql/src/pl_exec.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* procedural language
44
*
55
* IDENTIFICATION
6-
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.12 1999/07/04 01:03:01 tgl Exp $
6+
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.12.2.1 2000/01/16 00:45:33 tgl Exp $
77
*
88
* This software is copyrighted by Jan Wieck - Hamburg.
99
*
@@ -130,7 +130,7 @@ static void exec_move_row(PLpgSQL_execstate * estate,
130130
static Datum exec_cast_value(Datum value, Oid valtype,
131131
Oid reqtype,
132132
FmgrInfo *reqinput,
133-
int16 reqtypmod,
133+
int32 reqtypmod,
134134
bool *isnull);
135135
static void exec_set_found(PLpgSQL_execstate * estate, bool state);
136136

@@ -1561,7 +1561,7 @@ exec_stmt_raise(PLpgSQL_execstate * estate, PLpgSQL_stmt_raise * stmt)
15611561
typeStruct = (Form_pg_type) GETSTRUCT(typetup);
15621562

15631563
fmgr_info(typeStruct->typoutput, &finfo_output);
1564-
extval = (char *) (*fmgr_faddr(&finfo_output)) (var->value, &(var->isnull), var->datatype->atttypmod);
1564+
extval = (char *) (*fmgr_faddr(&finfo_output)) (var->value, InvalidOid, var->datatype->atttypmod);
15651565
}
15661566
plpgsql_dstring_append(&ds, extval);
15671567
break;
@@ -1874,7 +1874,7 @@ exec_assign_value(PLpgSQL_execstate * estate,
18741874
char *nulls;
18751875
bool attisnull;
18761876
Oid atttype;
1877-
int4 atttypmod;
1877+
int32 atttypmod;
18781878
HeapTuple typetup;
18791879
Form_pg_type typeStruct;
18801880
FmgrInfo finfo_input;
@@ -2373,7 +2373,7 @@ static Datum
23732373
exec_cast_value(Datum value, Oid valtype,
23742374
Oid reqtype,
23752375
FmgrInfo *reqinput,
2376-
int16 reqtypmod,
2376+
int32 reqtypmod,
23772377
bool *isnull)
23782378
{
23792379
if (!*isnull)
@@ -2383,7 +2383,7 @@ exec_cast_value(Datum value, Oid valtype,
23832383
* that of the variable, convert it.
23842384
* ----------
23852385
*/
2386-
if (valtype != reqtype || reqtypmod > 0)
2386+
if (valtype != reqtype || reqtypmod != -1)
23872387
{
23882388
HeapTuple typetup;
23892389
Form_pg_type typeStruct;
@@ -2397,8 +2397,8 @@ exec_cast_value(Datum value, Oid valtype,
23972397
typeStruct = (Form_pg_type) GETSTRUCT(typetup);
23982398

23992399
fmgr_info(typeStruct->typoutput, &finfo_output);
2400-
extval = (char *) (*fmgr_faddr(&finfo_output)) (value, &isnull, -1);
2401-
value = (Datum) (*fmgr_faddr(reqinput)) (extval, &isnull, reqtypmod);
2400+
extval = (char *) (*fmgr_faddr(&finfo_output)) (value, InvalidOid, -1);
2401+
value = (Datum) (*fmgr_faddr(reqinput)) (extval, InvalidOid, reqtypmod);
24022402
}
24032403
}
24042404

src/pl/plpgsql/src/plpgsql.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* procedural language
44
*
55
* IDENTIFICATION
6-
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.3 1999/01/27 16:15:22 wieck Exp $
6+
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.3.2.1 2000/01/16 00:45:33 tgl Exp $
77
*
88
* This software is copyrighted by Jan Wieck - Hamburg.
99
*
@@ -126,7 +126,7 @@ typedef struct
126126
Oid typoid;
127127
FmgrInfo typinput;
128128
bool typbyval;
129-
int16 atttypmod;
129+
int32 atttypmod;
130130
} PLpgSQL_type;
131131

132132

0 commit comments

Comments
 (0)