Skip to content Skip to sidebar Skip to footer

VARIADIC Parameter Must Be The Last Input Parameter

How to create two VARIADIC parameters. Look at my code and correct me. CREATE OR REPLACE FUNCTION ip_source_test(text,text,date,date,VARIADIC int[],VARIADIC text[]) RETURNS TABLE (

Solution 1:

There can be only one VARIADIC per function, since variadic encompasses all the other arguments passed by the caller.

If you mean for the caller to use arrays, there's no point in using variadic anyway, the function signature could look like:

CREATE FUNCTION ip_source_test(text,text,date,date,int[], text[])

Solution 2:

Just as the error message tells you:

VARIADIC parameter must be the last input parameter.

It follows logically that a function can only take a single VARIADIC parameter as last parameter. There can be other (non-VARIADIC) parameters before that one. Quoting the manual here:

Effectively, all the actual arguments at or beyond the VARIADIC position are gathered up into a one-dimensional array


Post a Comment for "VARIADIC Parameter Must Be The Last Input Parameter"