Index: src/pl/plpgsql/src/pl_exec.c =================================================================== RCS file: /projects/cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v retrieving revision 1.127.4.3 diff -u -r1.127.4.3 pl_exec.c --- src/pl/plpgsql/src/pl_exec.c 20 Jun 2005 22:51:49 -0000 1.127.4.3 +++ src/pl/plpgsql/src/pl_exec.c 14 Sep 2005 13:04:13 -0000 @@ -3243,8 +3243,7 @@ * * If expectedtypeid isn't InvalidOid, it is checked against the actual type. * - * This obviously only handles scalar datums (not whole records or rows); - * at present it doesn't need to handle PLpgSQL_expr datums, either. + * At present this doesn't handle PLpgSQL_expr or PLpgSQL_arrayelem datums. * * NOTE: caller must not modify the returned value, since it points right * at the stored value in the case of pass-by-reference datatypes. @@ -3864,19 +3863,20 @@ for (i = 0; i < natts; i++) { - PLpgSQL_var *var; + Oid fieldtypeid; if (tupdesc->attrs[i]->attisdropped) - continue; /* leave the column as null */ + { + nulls[i] = true; /* leave the column as null */ + continue; + } if (row->varnos[i] < 0) /* should not happen */ elog(ERROR, "dropped rowtype entry for non-dropped column"); - var = (PLpgSQL_var *) (estate->datums[row->varnos[i]]); - if (var->datatype->typoid != tupdesc->attrs[i]->atttypid) + exec_eval_datum(estate, estate->datums[row->varnos[i]], + InvalidOid, &fieldtypeid, &dvalues[i], &nulls[i]); + if (fieldtypeid != tupdesc->attrs[i]->atttypid) return NULL; - dvalues[i] = var->value; - if (!var->isnull) - nulls[i] = ' '; } tuple = heap_formtuple(tupdesc, dvalues, nulls);