From: Tom Lane Date: Tue, 24 Feb 2004 01:44:58 +0000 (+0000) Subject: Don't crash when a rowtype argument to a plpgsql function is NULL. X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=f0fb0c65664a7140eb988109c6b3479c9ae126d5;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 92f15d854e..6c0e62f6c2 100644 --- a/src/pl/plpgsql/src/pl_exec.c +++ b/src/pl/plpgsql/src/pl_exec.c @@ -265,10 +265,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;