Re: Variable number of arguments in C language function.
| От | Tom Lane |
|---|---|
| Тема | Re: Variable number of arguments in C language function. |
| Дата | |
| Msg-id | 29355.1017449865@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Variable number of arguments in C language function. (Daryl Tester <Daryl.Tester@iocane.com.au>) |
| Список | pgsql-general |
Daryl Tester <Daryl.Tester@iocane.com.au> writes:
> What I'm attempting to do is, and coming unstuck at, is to "CREATE
> FUNCTION" that allows a variable number of arguments to be passed
> in, without having to define a seperate function in pg_proc for
> each argument count.
There isn't any support for variable numbers of arguments; you're just
going to have to make N pg_proc entries pointing at the same C function.
> There is a comment in the FmgrInfo structure
> in include/fmgr.h about fn_nargs stating "or -1 if variable arg",
That's merely a note about a possible future expansion...
> My goal was to be able to pass in arguments of any type into the
> function and have it handle (and convert) the argument type, but
> (and this brainwave only occurred in the last five minutes) I
> suspect that I may not be able to extract the data type from Datum,
Nope, you won't. PG is not designed for weakly typed functions;
I doubt it's possible to make this work at all.
regards, tom lane
В списке pgsql-general по дате отправления: