On Mon, Mar 8, 2021, at 21:46, Pavel Stehule wrote:
> so what about?
>
> CREATE OR REPLACE FUNCTION unnest_slice(anyarray, int)
> RETURNS SETOF anyarray AS $$
> DECLARE r $1%type;
> BEGIN
> FOREACH r SLICE $2 IN ARRAY $1 --- now $2 should be constant
> LOOP
> RETURN NEXT r;
> END LOOP;
> END;
> $$ LANGUAGE plpgsql;
Not sure I understand. Is the suggestion to add "SLICE" as syntactic sugar in PL/pgSQL to invoke the proposed two-argument C-version of unnest()?
/Joel