I know there is the process of SELECT array_agg(f) FROM (SELECT blah FROM stuff) f
, which is great in SQL, but when writing functions in PL/pgSQL, is there a shorthand method??
I'm trying to put JSON keys into an array I can use to look at the length. Something like...
v_len := array_length( array_agg(json_object_keys(myjson)), 1);
instead of the long, DECLARE a variable, do a SELECT array_agg(f) INTO ...
, which I've been doing. I've seem hundreds of implementations using the same SQL string, but I really want to cut down my code, my fingers are going numb from all the redundant typing.
What am I missing with that shorthand method?