Larry White <ljw1001(at)gmail(dot)com> writes:
> mysql> create table t as ( select * from table_x);
That works in Postgres too. The SELECT INTO construct is a bit broken
since, as you discovered, it has a different meaning in plpgsql than
in the main SQL language. So I recommend using CREATE TABLE AS when
you want to create a table this way.
> The declarations section of the pl/pgsql documentation doesn't explain
> how to declare a variable to represent a set of rows
You can't. Possibly a cursor would help?
regards, tom lane