invalid INSERT on the root table of hypertable

ERROR: invalid INSERT on the root table of hypertable
HINT: Make sure the TimescaleDB extension has been preloaded.
Workaround is to recreate the table and reanable hypertables:


echo "
CREATE TABLE old_history (LIKE history INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES);
DROP TABLE history; alter table old_history RENAME TO history;
SELECT create_hypertable('history', 'clock', chunk_time_interval => 86400, migrate_data => true);

CREATE TABLE old_history_uint (LIKE history_uint INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES);
DROP TABLE history_uint; alter table old_history_uint RENAME TO history_uint;
SELECT create_hypertable('history_uint', 'clock', chunk_time_interval => 86400, migrate_data => true);

CREATE TABLE old_history_str (LIKE history_str INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES);
DROP TABLE history_str; alter table old_history_str RENAME TO history_str;
SELECT create_hypertable('history_str', 'clock', chunk_time_interval => 86400, migrate_data => true);

CREATE TABLE old_history_log (LIKE history_log INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES);
DROP TABLE history_log; alter table old_history_log RENAME TO history_log;
SELECT create_hypertable('history_log', 'clock', chunk_time_interval => 86400, migrate_data => true);

CREATE TABLE old_history_text (LIKE history_text INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES);
DROP TABLE history_text; alter table old_history_text RENAME TO history_text;
SELECT create_hypertable('history_text', 'clock', chunk_time_interval => 86400, migrate_data => true);

CREATE TABLE old_trends (LIKE trends INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES);
DROP TABLE trends; alter table old_trends RENAME TO trends;
SELECT create_hypertable('trends', 'clock', chunk_time_interval => 2592000, migrate_data => true);

CREATE TABLE old_trends_uint (LIKE trends_uint INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES);
DROP TABLE trends_uint; alter table old_trends_uint RENAME TO trends_uint;
SELECT create_hypertable('trends_uint', 'clock', chunk_time_interval => 2592000, migrate_data => true);

ALTER TABLE history OWNER TO zabbix;
ALTER TABLE history_uint OWNER TO zabbix;
ALTER TABLE history_log OWNER TO zabbix;
ALTER TABLE history_text OWNER TO zabbix;
ALTER TABLE history_str OWNER TO zabbix;
ALTER TABLE trends OWNER TO zabbix;
ALTER TABLE trends_uint OWNER TO zabbix;


No comments: