mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-21 21:21:22 +08:00
- Raise an exception upon an attach partition event on a hypertable to a native postgres partition
19 lines
1.1 KiB
MySQL
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');
|