Switch to another table in postgresql but keep a copy of the original

This probably won’t work for tables that contains columns used as foreign keys in other tables…

Anyway, first, rename the table you wish to turn into a backup copy
alter table aggregated_flights rename to aggregated_flights_old;

Then create the new table exactly like the original, using the “like” syntax
create table aggregated_flights (like aggregated_flights_old including all);

Verify that they are defined in the same way:
\d aggregated_flights
\d aggregated_flights_old

Do note that if a sequence is used to auto generate id’s, the same sequence will be used for both tables, which is not what you want. So make sure to use another sequence for one of the tables.