diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-05-09 18:18:54 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-05-09 18:18:54 +0000 |
commit | 38d9919d1ac22ca39b18acc4b8df457995101517 (patch) | |
tree | b492356939ea2425edb1073e2474c2fc9d54ed31 /src/backend/tcop/fastpath.c | |
parent | 0ac6298bb8ac11690cf3d4ad2537b4261ce93ab0 (diff) | |
download | postgresql-38d9919d1ac22ca39b18acc4b8df457995101517.tar.gz postgresql-38d9919d1ac22ca39b18acc4b8df457995101517.zip |
Now that fastpath protocol allows null arguments to be passed,
fastpath.c had better check for strict functions.
Diffstat (limited to 'src/backend/tcop/fastpath.c')
-rw-r--r-- | src/backend/tcop/fastpath.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/src/backend/tcop/fastpath.c b/src/backend/tcop/fastpath.c index 74971c49c5d..37b7c3d8d9d 100644 --- a/src/backend/tcop/fastpath.c +++ b/src/backend/tcop/fastpath.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.63 2003/05/09 18:08:48 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.64 2003/05/09 18:18:54 tgl Exp $ * * NOTES * This cruft is the server side of PQfn. @@ -273,6 +273,7 @@ HandleFunctionRequest(StringInfo msgBuf) Datum retval; struct fp_info my_fp; struct fp_info *fip; + bool callit; /* * Read message contents if not already done. @@ -341,8 +342,34 @@ HandleFunctionRequest(StringInfo msgBuf) /* Verify we reached the end of the message where expected. */ pq_getmsgend(msgBuf); - /* Okay, do it ... */ - retval = FunctionCallInvoke(&fcinfo); + /* + * If func is strict, must not call it for null args. + */ + callit = true; + if (fip->flinfo.fn_strict) + { + int i; + + for (i = 0; i < fcinfo.nargs; i++) + { + if (fcinfo.argnull[i]) + { + callit = false; + break; + } + } + } + + if (callit) + { + /* Okay, do it ... */ + retval = FunctionCallInvoke(&fcinfo); + } + else + { + fcinfo.isnull = true; + retval = (Datum) 0; + } SendFunctionResult(retval, fcinfo.isnull, fip->rettype, rformat); |