Re: Oracle Decode Function - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Oracle Decode Function
Date
Msg-id 25849.1027698217@sss.pgh.pa.us
Whole thread Raw
In response to Re: Oracle Decode Function  (Marc Lavergne <mlavergne-pub@richlava.com>)
List pgsql-hackers
Marc Lavergne <mlavergne-pub@richlava.com> writes:
>>> contrib/fulltextindex/fti.c uses variable numbers of arguments...
> I see the code, but maybe I don't SEE the code. I'm only on my second 
> cup of coffee so I may be missing something but I am not betting any 
> money in it :) Fulltextindex appears to work because it's called within 
> a trigger but I don't think you can get the parser not to complain about 
> arguments when your function is not called internally by the trigger 
> manager.

Right, fti.c is using a variable number of *trigger* arguments, which
is a whole different can of worms.

What you can do, if you are so inclined, is to rely on function
overloading to make several pg_proc entries of the same name and
different numbers of arguments that all point at the same underlying
C function.  Then the C function would have to check how many
arguments it was actually passed.  Slightly ugly, but doable.

There is some stuff in fmgr.h that anticipates a future feature of
real varargs function declarations ... but we don't support it yet.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Rod Taylor
Date:
Subject: Re: Password sub-process ...
Next
From: Tom Lane
Date:
Subject: Re: Password sub-process ...