sql - Postgresql: Return Temp Table From a Stored Procedure -


i want return result of query stored in temp table stored procedure. i'm not sure should last statement. appriciated:

create or replace function public.get_generic_info(     in in_app_id character varying,     in key_id uuid) returns table(info text, last_update timestamp time zone) $body$   begin     create temp table result         select  generic_info.info::text, generic_info.last_update                  generic_info          generic_info.app_id = in_app_id , generic_info.id = key_id;      -- data manipulations based on 'result' rows            return ???????; end; 

your last statement this

return query       select  result.info::text, result.last_update        result; 

if not using temp table else, there no need create temp table @ all..you can directly

return query select  generic_info.info::text, generic_info.last_update                  generic_info          generic_info.app_id = in_app_id , generic_info.id = key_id;