I would like to create 2d array inside a function and populate it with values from select statement. I try this code and end up with one-dimension array. What am I doing wrong?
select array(select a from t a)
=====================================
"{"(1,stxt,varchar)","(2,sint,int)"}"
create or replace function __test(
) returns text
language 'plpgsql' as
$$
declare
_dat varchar[][];
begin
_dat = (select array(select a from t a));
return array_dims(_dat);
end;
$$;
select __test();
===========
"[1:2]"
I expected last command to return [1:2][1:3] for two rows of three columns.