mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-22 13:40:56 +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.
20 lines
525 B
SQL
20 lines
525 B
SQL
\set ON_ERROR_STOP 1
|
|
\set VERBOSITY verbose
|
|
\set SHOW_CONTEXT never
|
|
|
|
\ir include/create_single_db.sql
|
|
|
|
\set ECHO ALL
|
|
\c single
|
|
|
|
create schema test_schema;
|
|
create table test_schema.test_table(time bigint, temp float8, device_id text);
|
|
\dt "test_schema".*
|
|
select * from create_hypertable('test_schema.test_table', 'time', 'device_id', 2);
|
|
|
|
--test partitioning in only time dimension
|
|
create table test_schema.test_1dim(time timestamp, temp float);
|
|
select create_hypertable('test_schema.test_1dim', 'time');
|
|
|
|
\dt "test_schema".*
|