|
8 | 8 | *
|
9 | 9 | *
|
10 | 10 | * IDENTIFICATION
|
11 |
| - * $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.63 2003/05/09 18:08:48 tgl Exp $ |
| 11 | + * $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.64 2003/05/09 18:18:54 tgl Exp $ |
12 | 12 | *
|
13 | 13 | * NOTES
|
14 | 14 | * This cruft is the server side of PQfn.
|
@@ -273,6 +273,7 @@ HandleFunctionRequest(StringInfo msgBuf)
|
273 | 273 | Datumretval;
|
274 | 274 | structfp_infomy_fp;
|
275 | 275 | structfp_info*fip;
|
| 276 | +boolcallit; |
276 | 277 |
|
277 | 278 | /*
|
278 | 279 | * Read message contents if not already done.
|
@@ -341,8 +342,34 @@ HandleFunctionRequest(StringInfo msgBuf)
|
341 | 342 | /* Verify we reached the end of the message where expected. */
|
342 | 343 | pq_getmsgend(msgBuf);
|
343 | 344 |
|
344 |
| -/* Okay, do it ... */ |
345 |
| -retval=FunctionCallInvoke(&fcinfo); |
| 345 | +/* |
| 346 | + * If func is strict, must not call it for null args. |
| 347 | + */ |
| 348 | +callit= true; |
| 349 | +if (fip->flinfo.fn_strict) |
| 350 | +{ |
| 351 | +inti; |
| 352 | + |
| 353 | +for (i=0;i<fcinfo.nargs;i++) |
| 354 | +{ |
| 355 | +if (fcinfo.argnull[i]) |
| 356 | +{ |
| 357 | +callit= false; |
| 358 | +break; |
| 359 | +} |
| 360 | +} |
| 361 | +} |
| 362 | + |
| 363 | +if (callit) |
| 364 | +{ |
| 365 | +/* Okay, do it ... */ |
| 366 | +retval=FunctionCallInvoke(&fcinfo); |
| 367 | +} |
| 368 | +else |
| 369 | +{ |
| 370 | +fcinfo.isnull= true; |
| 371 | +retval= (Datum)0; |
| 372 | +} |
346 | 373 |
|
347 | 374 | SendFunctionResult(retval,fcinfo.isnull,fip->rettype,rformat);
|
348 | 375 |
|
|