I have a function that loop a table and do processing returning values. I was returning SETOF VARCHAR[] and returning with RETURN NEXT the_varchar_array and worked fine.
But now I need to return some INTEGER before the VARCHAR[].
How I can define the returning value to return the INTEGER value and the VARCHAR[] and how I returning they inside the function?
If a define as RETURNS SETOF INTEGER, INTEGER, INTERGER, VARCHAR[], it don’t works.
If I use RETURNS TABLE(a INTEGER, b INTEGER, c INTEGER, d VARCHAR[]), works, but I don’t know how to return each value inside the function.
RETURN NEXT a,b,c,d doesn’t works. Only RETURN NEXT return an empty line.
This development documentation at PostgreSQL shows the different ways to return values from functions. You might have to look into a composite return type or a row of data containing all of your values.
Note – comment converted to an answer at the OP’s request