In a plpgsql function I'm doing returns table with a few columns to return a table with a few rows. But now I want to also return an individual scalar value along with it. So one individual scalar value, plus several rows. How can I do this?
An example is
select count(*) from exampletable into individidual_scalar_value;
select a, b, c from anothertable into several_rows limit 10;
returns tableorreturns some_custom_type). I now want to return an additional scalar value (such as the count of a table). The normal way to do it would be to just add a brand new function to return the scalar, and keep the existing function unchanged. But since these two values (the rows and the new scalar) will always be used together, I'd like to see what options there are to return them from the same function.