diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-02-24 01:44:47 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-02-24 01:44:47 +0000 |
commit | bce5fd63fd1421e8f404b1beefce45dc2aa6cc8d (patch) | |
tree | 150c360739a09b61f7e6d8e8ba279dd58108e4c4 /src | |
parent | 6b534f3c3394f86ec79cd764a0413e56af26773a (diff) | |
download | postgresql-bce5fd63fd1421e8f404b1beefce45dc2aa6cc8d.tar.gz postgresql-bce5fd63fd1421e8f404b1beefce45dc2aa6cc8d.zip |
Don't crash when a rowtype argument to a plpgsql function is NULL.
Per report from Chris Campbell.
Diffstat (limited to 'src')
-rw-r--r-- | src/pl/plpgsql/src/pl_exec.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c index a69af302306..0f42d048236 100644 --- a/src/pl/plpgsql/src/pl_exec.c +++ b/src/pl/plpgsql/src/pl_exec.c @@ -3,7 +3,7 @@ * procedural language * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.93 2003/10/01 21:47:42 tgl Exp $ + * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.93.2.1 2004/02/24 01:44:47 tgl Exp $ * * This software is copyrighted by Jan Wieck - Hamburg. * @@ -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; |