Difference between revisions of "Timescaledb Migrate"
Jump to navigation
Jump to search
(Created page with "https://stackoverflow.com/questions/57910070/convert-hypertable-to-regular-postgres-table") |
|||
Line 1: | Line 1: | ||
https://stackoverflow.com/questions/57910070/convert-hypertable-to-regular-postgres-table | https://stackoverflow.com/questions/57910070/convert-hypertable-to-regular-postgres-table | ||
+ | |||
+ | ``` | ||
+ | CREATE TABLE pg_conditions (LIKE conditions INCLUDING ALL); -- duplicate table structure | ||
+ | INSERT INTO pg_conditions (SELECT * FROM conditions); -- copy all data | ||
+ | DROP TABLE conditions; -- drops hypertable | ||
+ | ALTER TABLE pg_conditions RENAME TO conditions; -- conditions is now a regular postgres table again | ||
+ | ``` |
Latest revision as of 22:07, 28 May 2022
https://stackoverflow.com/questions/57910070/convert-hypertable-to-regular-postgres-table
CREATE TABLE pg_conditions (LIKE conditions INCLUDING ALL); -- duplicate table structure INSERT INTO pg_conditions (SELECT * FROM conditions); -- copy all data DROP TABLE conditions; -- drops hypertable ALTER TABLE pg_conditions RENAME TO conditions; -- conditions is now a regular postgres table again