In question How to generate an array of given size, with one field populated? I was instructed instead of using “returns” to use “OUT”
instead of:
create function arraycol(v anyelement,n int,i int) returns anyarray language plpgsql as $$ .. $$;
use:
create function arraycol(v anyelement,n int,i int,OUT r anyarray) language plpgsql as $$ ... $$;
The above was because you cannot give to “returns” a type anyarray.
As it seems that OUT is more flexible than returns, I am considering to use always the OUT syntax instead of returns, an I am wondering if there is any counter indication.
Let’s clarify that if there are two OUT a record with two values is returned, an thus only when the OUT is single the result is the same as returns.
Please clarify if there is any difference or reason to avoid.