diff options
author | Bruce Momjian <bruce@momjian.us> | 2002-09-12 00:26:42 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2002-09-12 00:26:42 +0000 |
commit | 7184a428a2f8d78b3165f7939e3f44ade01a90f2 (patch) | |
tree | 1d62fbc85b4140c5e8770faf30918a3979fa5281 /src | |
parent | e57ab0456506b3f68b4d8f446c58e6677e120294 (diff) | |
download | postgresql-7184a428a2f8d78b3165f7939e3f44ade01a90f2.tar.gz postgresql-7184a428a2f8d78b3165f7939e3f44ade01a90f2.zip |
The small context diff below corrects what seems to be an oversight in
fmgr.h - it's discouraged to access fcinfo directly but there is no
macro to get the number of arguments passed to the function. Checking
the number of arguments is often useful when you have a function which
can be called like:
func('arg');
func(null);
func();
all mapping to the same C function.
the macro has a function-like appearance to match the other PG_*
macros.
Lee Kindness.
Diffstat (limited to 'src')
-rw-r--r-- | src/include/fmgr.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/include/fmgr.h b/src/include/fmgr.h index a421ba903ac..0e58167589a 100644 --- a/src/include/fmgr.h +++ b/src/include/fmgr.h @@ -11,7 +11,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: fmgr.h,v 1.24 2002/09/04 20:31:36 momjian Exp $ + * $Id: fmgr.h,v 1.25 2002/09/12 00:26:42 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -116,6 +116,11 @@ extern void fmgr_info_copy(FmgrInfo *dstinfo, FmgrInfo *srcinfo, #define PG_FUNCTION_ARGS FunctionCallInfo fcinfo /* + * Get number of arguments passed to function. + */ +#define PG_NARGS() (fcinfo->nargs) + +/* * If function is not marked "proisstrict" in pg_proc, it must check for * null arguments using this macro. Do not try to GETARG a null argument! */ |