Postgresql table function: get where condition
The temporary table will only make things slower, you don't need it. And if you change the function to be a SQL function, the Postgres optimizer can push the condition from the WHERE clause automatically into the query inside the function:

create or replace function public.fn_world_cities()
  returns table (city_id int, city_name varchar, country_id int)
as $$
  select city_id, city_name, country_id
  from public.table_world_cities
  where row_status = 'A';
$$ 
language sql 
STABLE; --&lt;&lt; this is important!


If you now run:

select * 
from public.fn_world_cities() 
where country_id = 10;


And country_id has an index that is worth using, Postgres will use it Note that you need a non-trivial number of rows in that table, and the condition needs to be selective enough to warrant an index scan (as with any other index usage)