timescaledb/test/sql/partitioning.sql.in
jwdeitch 6cfdd7904b Prevent native partitioning attachment of hypertables
- Raise an exception upon an attach partition event on a hypertable to a native postgres partition
2017-12-18 13:01:16 +01:00

19 lines
1.1 KiB
MySQL

-- Should expect an error when creating a hypertable from a partition
\set ON_ERROR_STOP 0
CREATE TABLE partitioned_ht_create(time timestamptz, temp float, device int) PARTITION BY RANGE (time);
SELECT create_hypertable('partitioned_ht_create', 'time');
\set ON_ERROR_STOP 1
-- Should expect an error when attaching a hypertable to a partition
\set ON_ERROR_STOP 0
CREATE TABLE partitioned_attachment_vanilla(time timestamptz, temp float, device int) PARTITION BY RANGE (time);
CREATE TABLE attachment_hypertable(time timestamptz, temp float, device int);
SELECT create_hypertable('attachment_hypertable', 'time');
ALTER TABLE partitioned_attachment_vanilla ATTACH PARTITION attachment_hypertable FOR VALUES FROM ('2016-07-01') TO ('2016-08-01');
\set ON_ERROR_STOP 1
-- Should not expect an error when attaching a normal table to a partition
CREATE TABLE partitioned_vanilla(time timestamptz, temp float, device int) PARTITION BY RANGE (time);
CREATE TABLE attachment_vanilla(time timestamptz, temp float, device int);
ALTER TABLE partitioned_vanilla ATTACH PARTITION attachment_vanilla FOR VALUES FROM ('2016-07-01') TO ('2016-08-01');