How to use a record variable in the from clausule I write a SQL function that receives and return a record. I need to use the received record in a from clause. I am using unnest(array[the_variable]). 

Is there a specific function or structure to do this? (something like record_to_recordset(the_variable))

Here is my example:

create type calculate_info_type as (super_code text, super_name text);

create function calculate_info(p_country country) 
   returns calculate_info_type 
   language SQL as
$SQL$
   SELECT super_code, super_name 
     FROM unnest(array[p_country]), -- &lt;=== HERE!!
          lateral (select 
            prefix is not null as has_prefix
          ) g1,valores que tenga la tabla
          lateral (select 
            case has_prefix when true then iso||'-'||prefix else iso end as super_code,
            case has_prefix when true then name else name||' without phone prefix' end as super_name
          ) g2 
$SQL$;


I put a complete running example here: https://rextester.com/XIRSW33377
Short answer (edited)

You can write FROM (select p_country.*) some_alias instead of FROM unnest(array[p_country])

Question code with minimal corrections: https://rextester.com/UGKJR74935

Original answer (with many usefull suggestions)

Looks like you want something like this:

create function calculate_info(p_country country) 
   returns calculate_info_type 
   language SQL as
$SQL$
   select case when has_prefix then iso||'-'||prefix else iso end as super_code,
          case when has_prefix then name else name||' without phone prefix' end as super_name
   FROM (
      select (p_country).*, p_country.prefix is not null as has_prefix
   ) as c
$SQL$;


But you don't really need the from at all: 

create function calculate_info(p_country country) 
   returns calculate_info_type 
   language SQL 
as
$SQL$
   select concat_ws(',', p_country.iso, p_country.prefix) super_code,
          case 
            when p_country.prefix is not null then p_country.name 
            else p_country.name||' without phone prefix' 
          end as super_name;
$SQL$;


concat_ws will return only the value from the iso field if prefix is null. 

You don't need a lateral to use that function:

select iso, prefix, name, (calculate_info(country)).*
from country


Your updated example: https://rextester.com/GVLK52206