Fix NOT NULL option for plpgsql variables (doesn't look like it
could ever have worked...)
This commit is contained in:
parent
0ad5e43772
commit
682b128993
|
@ -3,7 +3,7 @@
|
||||||
* procedural language
|
* procedural language
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.34 2001/01/04 02:38:02 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.35 2001/01/06 01:43:01 tgl Exp $
|
||||||
*
|
*
|
||||||
* This software is copyrighted by Jan Wieck - Hamburg.
|
* This software is copyrighted by Jan Wieck - Hamburg.
|
||||||
*
|
*
|
||||||
|
@ -2210,6 +2210,7 @@ exec_assign_value(PLpgSQL_execstate * estate,
|
||||||
int natts;
|
int natts;
|
||||||
Datum *values;
|
Datum *values;
|
||||||
char *nulls;
|
char *nulls;
|
||||||
|
Datum newvalue;
|
||||||
bool attisnull;
|
bool attisnull;
|
||||||
Oid atttype;
|
Oid atttype;
|
||||||
int32 atttypmod;
|
int32 atttypmod;
|
||||||
|
@ -2225,15 +2226,16 @@ exec_assign_value(PLpgSQL_execstate * estate,
|
||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
var = (PLpgSQL_var *) target;
|
var = (PLpgSQL_var *) target;
|
||||||
var->value = exec_cast_value(value, valtype, var->datatype->typoid,
|
newvalue = exec_cast_value(value, valtype, var->datatype->typoid,
|
||||||
&(var->datatype->typinput),
|
&(var->datatype->typinput),
|
||||||
var->datatype->typelem,
|
var->datatype->typelem,
|
||||||
var->datatype->atttypmod,
|
var->datatype->atttypmod,
|
||||||
isNull);
|
isNull);
|
||||||
|
|
||||||
if (isNull && var->notnull)
|
if (*isNull && var->notnull)
|
||||||
elog(ERROR, "NULL assignment to variable '%s' declared NOT NULL", var->refname);
|
elog(ERROR, "NULL assignment to variable '%s' declared NOT NULL", var->refname);
|
||||||
|
|
||||||
|
var->value = newvalue;
|
||||||
var->isnull = *isNull;
|
var->isnull = *isNull;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue