From: Tom Lane Date: Tue, 24 Feb 2004 01:44:47 +0000 (+0000) Subject: Don't crash when a rowtype argument to a plpgsql function is NULL. X-Git-Url: http://waps.l3s.uni-hannover.de/gitweb/?a=commitdiff_plain;h=47282a3830e7785a7b5ad0dc851345c82bd39f92;p=users%2Fbernd%2Fpostgres.git Don't crash when a rowtype argument to a plpgsql function is NULL. Per report from Chris Campbell. --- diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c index df2ae82226..9a670f252e 100644 --- a/src/pl/plpgsql/src/pl_exec.c +++ b/src/pl/plpgsql/src/pl_exec.c @@ -262,10 +262,18 @@ plpgsql_exec_function(PLpgSQL_function * func, FunctionCallInfo fcinfo) HeapTuple tup; TupleDesc tupdesc; - Assert(slot != NULL && !fcinfo->argnull[i]); - tup = slot->val; - tupdesc = slot->ttc_tupleDescriptor; - exec_move_row(&estate, NULL, row, tup, tupdesc); + if (!fcinfo->argnull[i]) + { + Assert(slot != NULL); + tup = slot->val; + tupdesc = slot->ttc_tupleDescriptor; + exec_move_row(&estate, NULL, row, tup, tupdesc); + } + else + { + /* If arg is null, treat it as an empty row */ + exec_move_row(&estate, NULL, row, NULL, NULL); + } } break;