Skip to content

Commit 55fb172

Browse files
committed
Don't crash when a rowtype argument to a plpgsql function is NULL.
Per report from Chris Campbell.
1 parent 3f2cf81 commit 55fb172

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/pl/plpgsql/src/pl_exec.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* procedural language
44
*
55
* IDENTIFICATION
6-
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.95 2004/02/03 17:34:04 tgl Exp $
6+
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.96 2004/02/24 01:44:33 tgl Exp $
77
*
88
* This software is copyrighted by Jan Wieck - Hamburg.
99
*
@@ -262,10 +262,18 @@ plpgsql_exec_function(PLpgSQL_function * func, FunctionCallInfo fcinfo)
262262
HeapTuple tup;
263263
TupleDesc tupdesc;
264264

265-
Assert(slot != NULL && !fcinfo->argnull[i]);
266-
tup = slot->val;
267-
tupdesc = slot->ttc_tupleDescriptor;
268-
exec_move_row(&estate, NULL, row, tup, tupdesc);
265+
if (!fcinfo->argnull[i])
266+
{
267+
Assert(slot != NULL);
268+
tup = slot->val;
269+
tupdesc = slot->ttc_tupleDescriptor;
270+
exec_move_row(&estate, NULL, row, tup, tupdesc);
271+
}
272+
else
273+
{
274+
/* If arg is null, treat it as an empty row */
275+
exec_move_row(&estate, NULL, row, NULL, NULL);
276+
}
269277
}
270278
break;
271279

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy