Fastest way to do insert in a table A with same structure of a table B:
INSERT INTO A SELECT * FROM B
I can't rename table because in table A there are indexes that when query is executed it's impossible to know without read catalog and create a dynamic script to modify table B to be equal to table A. Also, on table A there are on it some views than it's difficult to delete.
I can't use
COPY command to make a COPY TO and next a COPY FROM because database user haven't permission on file and directory.
Is there a way to do a
COPY A FROM (SELECT * FROM B) ?
PostgreSQL version 9.2.
Your question states the correct answer:
INSERT INTO A SELECT * FROM B;
That's all you need.
Now you can also do this if A doesn't exist yet:
CREATE TABLE A (LIKE B INCLUDING ALL); INSERT INTO A SELECT * FROM B;