summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2000-01-16 00:45:33 +0000
committerTom Lane2000-01-16 00:45:33 +0000
commit578556264ab318094686d93068ffec7dca6ae6b4 (patch)
tree33d44be5a36dcc32f5f9ed5692d942fd12dd9400
parent875841685c9401f9b68ce87c612941fa732112d1 (diff)
Back-patch critical fixes for NUMERIC values in plpgsql functions.REL6_5_PATCHES
-rw-r--r--src/pl/plpgsql/src/pl_exec.c14
-rw-r--r--src/pl/plpgsql/src/plpgsql.h2
2 files changed, 8 insertions, 8 deletions
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index e19fb8d193..a12ace0b05 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -130,7 +130,7 @@ static void exec_move_row(PLpgSQL_execstate * estate,
static Datum exec_cast_value(Datum value, Oid valtype,
Oid reqtype,
FmgrInfo *reqinput,
- int16 reqtypmod,
+ int32 reqtypmod,
bool *isnull);
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);
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);
break;
@@ -1874,7 +1874,7 @@ exec_assign_value(PLpgSQL_execstate * estate,
char *nulls;
bool attisnull;
Oid atttype;
- int4 atttypmod;
+ int32 atttypmod;
HeapTuple typetup;
Form_pg_type typeStruct;
FmgrInfo finfo_input;
@@ -2373,7 +2373,7 @@ static Datum
exec_cast_value(Datum value, Oid valtype,
Oid reqtype,
FmgrInfo *reqinput,
- int16 reqtypmod,
+ int32 reqtypmod,
bool *isnull)
{
if (!*isnull)
@@ -2383,7 +2383,7 @@ exec_cast_value(Datum value, Oid valtype,
* that of the variable, convert it.
* ----------
*/
- if (valtype != reqtype || reqtypmod > 0)
+ if (valtype != reqtype || reqtypmod != -1)
{
HeapTuple typetup;
Form_pg_type typeStruct;
@@ -2397,8 +2397,8 @@ exec_cast_value(Datum value, Oid valtype,
typeStruct = (Form_pg_type) GETSTRUCT(typetup);
fmgr_info(typeStruct->typoutput, &finfo_output);
- extval = (char *) (*fmgr_faddr(&finfo_output)) (value, &isnull, -1);
- value = (Datum) (*fmgr_faddr(reqinput)) (extval, &isnull, reqtypmod);
+ extval = (char *) (*fmgr_faddr(&finfo_output)) (value, InvalidOid, -1);
+ value = (Datum) (*fmgr_faddr(reqinput)) (extval, InvalidOid, reqtypmod);
}
}
diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h
index e1458c3b89..8212f1147b 100644
--- a/src/pl/plpgsql/src/plpgsql.h
+++ b/src/pl/plpgsql/src/plpgsql.h
@@ -126,7 +126,7 @@ typedef struct
Oid typoid;
FmgrInfo typinput;
bool typbyval;
- int16 atttypmod;
+ int32 atttypmod;
} PLpgSQL_type;