# [EMAIL PROTECTED] / 2005-09-13 12:17:06 -0400: > Roman Neuhauser <[EMAIL PROTECTED]> writes: > > Looking at src/pl/plpgsql/src/pl_exec.c for the first time, is it a problem > > of make_tuple_from_row() not accounting for nested composite types? > > Looks that way. I've committed a fix to HEAD. I'm not sure how hard > it'd be to fix 8.0.
Thanks for the fast fix, it's really appreciated. I tried to hammer[1] your patch[2] onto the REL8_0_STABLE branch (attached), but am getting ERROR: out of memory DETAIL: Failed on request of size 1073741823. CONTEXT: PL/pgSQL function "breakme" while storing call arguments into local variables I'm sorry to be a nuisance, but is this interesting enough for someone in the know that they'd backport the patch into 8.0? [1] see attachment [2] http://developer.postgresql.org/cvsweb.cgi/pgsql/src/pl/plpgsql/src/pl_exec.c.diff?r1=1.151;r2=1.152 -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991
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);
---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq