This works fine but I am not sure whether the ordering remains in the later use.
It does not. If the array is not naturally ordered you will want to attach a "with ordinality" clause to it for performing future ordering.
select * from unnest(ARRAY[3,6,4]::integer[]) with ordinality
Use LATERAL to move the unnest from the select-list section to the FROM clause.
David J.