In some step of a plpgsql function I need to store a 2D query result into array variables.
The following code does the job for scalars (but fails with arrays):
SELECT col_a, col_b FROM my_table WHERE col_c = condition INTO var_a, var_b;
The following does the job for ONE column and ONE array variable but not more than that:
SELECT ARRAY( SELECT col_a FROM my_table WHERE col_c > condition ) INTO arr_a;
How could I store multiple rows from col_a, b, c, d… Into their respective array variables without having to do a separate query for each column? Like in the first code example but for multiple rows and arrays.
Thanks for your time.