diff --git a/nix/tests/expected/timescale.out b/nix/tests/expected/timescale.out new file mode 100644 index 000000000..d32b8e9f3 --- /dev/null +++ b/nix/tests/expected/timescale.out @@ -0,0 +1,40 @@ +-- Create schema v +create schema v; +-- Create a table in the v schema +create table v.sensor_data ( + time timestamptz not null, + sensor_id int not null, + temperature double precision not null, + humidity double precision not null +); +-- Convert the table to a hypertable +select create_hypertable('v.sensor_data', 'time'); + create_hypertable +--------------------- + (1,v,sensor_data,t) +(1 row) + +-- Insert some data into the hypertable +insert into v.sensor_data (time, sensor_id, temperature, humidity) +values + ('2024-08-09', 1, 22.5, 60.2), + ('2024-08-08', 1, 23.0, 59.1), + ('2024-08-07', 2, 21.7, 63.3); +-- Select data from the hypertable +select + * +from + v.sensor_data; + time | sensor_id | temperature | humidity +------------------------------+-----------+-------------+---------- + Fri Aug 09 00:00:00 2024 PDT | 1 | 22.5 | 60.2 + Thu Aug 08 00:00:00 2024 PDT | 1 | 23 | 59.1 + Wed Aug 07 00:00:00 2024 PDT | 2 | 21.7 | 63.3 +(3 rows) + +-- Drop schema v and all its entities +drop schema v cascade; +NOTICE: drop cascades to 3 other objects +DETAIL: drop cascades to table v.sensor_data +drop cascades to table _timescaledb_internal._hyper_1_1_chunk +drop cascades to table _timescaledb_internal._hyper_1_2_chunk diff --git a/nix/tests/sql/timescale.sql b/nix/tests/sql/timescale.sql new file mode 100644 index 000000000..939612a4a --- /dev/null +++ b/nix/tests/sql/timescale.sql @@ -0,0 +1,30 @@ +-- Create schema v +create schema v; + +-- Create a table in the v schema +create table v.sensor_data ( + time timestamptz not null, + sensor_id int not null, + temperature double precision not null, + humidity double precision not null +); + +-- Convert the table to a hypertable +select create_hypertable('v.sensor_data', 'time'); + +-- Insert some data into the hypertable +insert into v.sensor_data (time, sensor_id, temperature, humidity) +values + ('2024-08-09', 1, 22.5, 60.2), + ('2024-08-08', 1, 23.0, 59.1), + ('2024-08-07', 2, 21.7, 63.3); + +-- Select data from the hypertable +select + * +from + v.sensor_data; + +-- Drop schema v and all its entities +drop schema v cascade; +