CREATE TABLE AS is functionally similar to SELECT INTO. CREATE TABLE AS is the recommended syntax, since this form of SELECT INTO is not available in ECPG or PL/pgSQL, because they interpret the INTO clause differently. Furthermore, CREATE TABLE AS offers a superset of the functionality provided by SELECT INTO
CREATE OR REPLACE FUNCTION whatever()
RETURNS void AS $$
BEGIN
create temp table as
SELECT *
FROM orig_table;
END; $$ LANGUAGE plpgsql;