mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-16 18:43:18 +08:00
Since create_hypertable() allows you to optionally specify a partitioning column, it makes sense to default to one partition when no column is specified and asking for the number of partitions when a column is specified and the number of partitions is not (instead of defaulting to one). This patch also changes the order and type of partitioning-related input arguments to create_hypertable() so that the number of partitions can easily be specified alongside the partitioning column and without type casting.
34 lines
957 B
SQL
34 lines
957 B
SQL
|
|
\set ON_ERROR_STOP 1
|
|
\set SHOW_CONTEXT never
|
|
|
|
\ir include/create_single_db.sql
|
|
|
|
\set ECHO ALL
|
|
\c single
|
|
|
|
\set ON_ERROR_STOP 0
|
|
|
|
SET client_min_messages = ERROR;
|
|
drop tablespace if exists tspace1;
|
|
SET client_min_messages = NOTICE;
|
|
|
|
\set VERBOSITY verbose
|
|
|
|
--test hypertable with tables space
|
|
create tablespace tspace1 location :TEST_TABLESPACE_PATH;
|
|
create table test_tspace(time timestamp, temp float, device_id text) tablespace tspace1;
|
|
select create_hypertable('test_tspace', 'time', 'device_id', 2);
|
|
select * from _timescaledb_catalog.partition p INNER JOIN _timescaledb_catalog.partition_replica pr ON (pr.partition_id = p.id);
|
|
insert into test_tspace values ('2017-01-20T09:00:01', 24.3, 'dev1');
|
|
insert into test_tspace values ('2017-01-20T09:00:02', 22.3, 'dev7');
|
|
\dt test_tspace
|
|
|
|
--verify that the table chunk has the correct tablespace
|
|
\d+ _timescaledb_internal.*
|
|
|
|
--cleanup
|
|
\set VERBOSITY default
|
|
drop table test_tspace;
|
|
drop tablespace tspace1;
|