Are there any options in PostgreSQL to achieve this other than using a temp table ?
Since the names of the tables are dynamic you would need to use pl/pgsql and its EXECUTE capability and build up a useful SQL command on-the-fly. To avoid using temporary tables you would need to put all the separate queries into the same main query. This can be done with "UNION" and/(or?) Common Table Expressions (CTE - the WITH clause).