I am trying to define a plpgsql function in Postgresql 10 with several parameters, including an array.
I have already defined the function
CREATE OR REPLACE FUNCTION mix_table_fields(input_table_name VARCHAR, output_table_name VARCHAR, VARIADIC field_names VARCHAR[])
[...]
Now, when I try to call it:
SELECT mix_table_fields('articles'::VARCHAR, 'output_random_articles'::VARCHAR, array['type'::varchar,'colour'::varchar,'size'::varchar,'price'::varchar]) ;
I get the following error : " the function mix_table_fields(character varying, character varying, character varying[]) does not exist".
I have had this error before. It cannot recognize the signature of the function (its input parameters).
When I use pgAdmin3 to look at the function definition, it is:
CREATE OR REPLACE FUNCTION public.mix_table_fields(
IN input_table_name character varying,
IN output_table_name character varying,
VARIADIC field_names character varying[])
I cannot see what's wrong.
And if there is a way of getting rid of the ::VARCHAR
at each parameter when calling the function, it would be easier.