timescaledb/test/sql/drop_hypertable.sql
Erik Nordström 347a8bdacf Reference the correct column when scanning partition epochs
This fixes a bug that caused the wrong column to be referenced when
scanning the partition_epoch table. The bug did not usually manifest
itself because the referenced (hypertable) ID was typically
incremented in unison with the desired (partition epoch) ID.
2017-05-31 14:55:54 +02:00

23 lines
823 B
SQL

\ir include/create_single_db.sql
SELECT * from _timescaledb_catalog.hypertable;
SELECT * from _timescaledb_catalog.partition_epoch;
CREATE TABLE should_drop (time timestamp, temp float8);
SELECT create_hypertable('should_drop', 'time');
-- Calling create hypertable again will increment hypertable ID
-- although no new hypertable is created. Make sure we can handle this.
SELECT create_hypertable('should_drop', 'time', if_not_exists => true);
SELECT * from _timescaledb_catalog.hypertable;
SELECT * from _timescaledb_catalog.partition_epoch;
DROP TABLE should_drop;
CREATE TABLE should_drop (time timestamp, temp float8);
SELECT create_hypertable('should_drop', 'time');
INSERT INTO should_drop VALUES (now(), 1.0);
SELECT * from _timescaledb_catalog.hypertable;
SELECT * from _timescaledb_catalog.partition_epoch;