fmgr.h: PG_NARGS() for number of arguments passed

Поиск
Список
Период
Сортировка
От Lee Kindness
Тема fmgr.h: PG_NARGS() for number of arguments passed
Дата
Msg-id 15743.17453.912687.96063@kelvin.csl.co.uk
обсуждение исходный текст
Ответы Re: fmgr.h: PG_NARGS() for number of arguments passed  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: fmgr.h: PG_NARGS() for number of arguments passed  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-patches
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.

Regards, Lee Kindness.

Index: fmgr.h
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/include/fmgr.h,v
retrieving revision 1.24
diff -c -r1.24 fmgr.h
*** fmgr.h    2002/09/04 20:31:36    1.24
--- fmgr.h    2002/09/10 13:25:06
***************
*** 116,121 ****
--- 116,126 ----
  #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!
   */

В списке pgsql-patches по дате отправления:

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: JDBC Driver Database Meta Data - FK_NAME
Следующее
От: greg@turnstep.com
Дата:
Сообщение: Re: [GENERAL] psql: \pset pager 'always'?