# Note that if the input is not rectangular, the output might be lossy. create or replace function transpose(lst) as ( select list_transform( range(1, 1+length(lst[1])), j -> list_transform(range(1, length(lst)+1), i -> lst[i][j]) ));