CREATE OR REPLACE FUNCTION words_get_board( in_gid integer ) RETURNS TABLE ( out_bid integer, out_letters varchar[15][15], out_values integer[15][15] ) AS $func$ SELECT bid, letters, values FROM words_games WHERE gid = in_gid;
$func$ LANGUAGE sql STABLE;
I am not seeing where you assign the results of your SELECT to the OUT parameters in the RETURNS TABLE. Nor do I see anything that turns the results into an array for those OUT parameters of array type.
The function isn't the problem here - its in SQL language. Explicit assignment is needed in pl/pgsql.