8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.254 2010/01/19 01:35:31 tgl Exp $
11
+ * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.255 2010/02/12 19:37:36 tgl Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -3520,11 +3520,6 @@ exec_assign_value(PLpgSQL_execstate *estate,
3520
3520
*/
3521
3521
PLpgSQL_row * row = (PLpgSQL_row * ) target ;
3522
3522
3523
- /* Source must be of RECORD or composite type */
3524
- if (!type_is_rowtype (valtype ))
3525
- ereport (ERROR ,
3526
- (errcode (ERRCODE_DATATYPE_MISMATCH ),
3527
- errmsg ("cannot assign non-composite value to a row variable" )));
3528
3523
if (* isNull )
3529
3524
{
3530
3525
/* If source is null, just assign nulls to the row */
@@ -3538,7 +3533,12 @@ exec_assign_value(PLpgSQL_execstate *estate,
3538
3533
TupleDesc tupdesc ;
3539
3534
HeapTupleData tmptup ;
3540
3535
3541
- /* Else source is a tuple Datum, safe to do this: */
3536
+ /* Source must be of RECORD or composite type */
3537
+ if (!type_is_rowtype (valtype ))
3538
+ ereport (ERROR ,
3539
+ (errcode (ERRCODE_DATATYPE_MISMATCH ),
3540
+ errmsg ("cannot assign non-composite value to a row variable" )));
3541
+ /* Source is a tuple Datum, so safe to do this: */
3542
3542
td = DatumGetHeapTupleHeader (value );
3543
3543
/* Extract rowtype info and find a tupdesc */
3544
3544
tupType = HeapTupleHeaderGetTypeId (td );
@@ -3562,11 +3562,6 @@ exec_assign_value(PLpgSQL_execstate *estate,
3562
3562
*/
3563
3563
PLpgSQL_rec * rec = (PLpgSQL_rec * ) target ;
3564
3564
3565
- /* Source must be of RECORD or composite type */
3566
- if (!type_is_rowtype (valtype ))
3567
- ereport (ERROR ,
3568
- (errcode (ERRCODE_DATATYPE_MISMATCH ),
3569
- errmsg ("cannot assign non-composite value to a record variable" )));
3570
3565
if (* isNull )
3571
3566
{
3572
3567
/* If source is null, just assign nulls to the record */
@@ -3580,7 +3575,13 @@ exec_assign_value(PLpgSQL_execstate *estate,
3580
3575
TupleDesc tupdesc ;
3581
3576
HeapTupleData tmptup ;
3582
3577
3583
- /* Else source is a tuple Datum, safe to do this: */
3578
+ /* Source must be of RECORD or composite type */
3579
+ if (!type_is_rowtype (valtype ))
3580
+ ereport (ERROR ,
3581
+ (errcode (ERRCODE_DATATYPE_MISMATCH ),
3582
+ errmsg ("cannot assign non-composite value to a record variable" )));
3583
+
3584
+ /* Source is a tuple Datum, so safe to do this: */
3584
3585
td = DatumGetHeapTupleHeader (value );
3585
3586
/* Extract rowtype info and find a tupdesc */
3586
3587
tupType = HeapTupleHeaderGetTypeId (td );
@@ -4759,6 +4760,10 @@ exec_move_row(PLpgSQL_execstate *estate,
4759
4760
{
4760
4761
value = (Datum ) 0 ;
4761
4762
isnull = true;
4763
+ /*
4764
+ * InvalidOid is OK because exec_assign_value doesn't care
4765
+ * about the type of a source NULL
4766
+ */
4762
4767
valtype = InvalidOid ;
4763
4768
}
4764
4769
0 commit comments