Closed johnmudd closed 9 years ago
Wouldn't 'select into' work? -- http://www.postgresql.org/docs/9.4/static/sql-selectinto.html
SELECT INTO executes and creates the new table but the new table has no columns or rows.
What do you mean ? Could you post an example ?
Both forms work for me:
select * into table new_local_table from foreign_table; create table new_local_table AS (select * from foreign_table);
You are correct, thanks! I tried "SELECT INTO" instead of "SELECT * INTO".
Any suggestions to convert a foreign table to real table?
So far I can use pg_dump to get the CREATE TABLE statement. After editing the output.
And I can use the following to dump the data. Is there a better approach?
COPY (SELECT * from my_fdw_table) TO STDOUT WITH CSV HEADER;