mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-22 22:11:29 +08:00
To increase schema security we do not want to mix our own internal objects with user objects. Since chunks are created in the _timescaledb_internal schema our internal functions should live in a different dedicated schema. This patch make the necessary adjustments for the following functions: - to_unix_microseconds(timestamptz) - to_timestamp(bigint) - to_timestamp_without_timezone(bigint) - to_date(bigint) - to_interval(bigint) - interval_to_usec(interval) - time_to_internal(anyelement) - subtract_integer_from_now(regclass, bigint)
26 lines
1.0 KiB
SQL
26 lines
1.0 KiB
SQL
-- This file and its contents are licensed under the Apache License 2.0.
|
|
-- Please see the included NOTICE for copyright information and
|
|
-- LICENSE-APACHE for a copy of the license.
|
|
|
|
-- Test a hypertable using timestamps
|
|
CREATE TABLE PUBLIC.hyper_timestamp (
|
|
time timestamp NOT NULL,
|
|
device_id TEXT NOT NULL,
|
|
value int NOT NULL
|
|
);
|
|
|
|
|
|
DO $$
|
|
BEGIN
|
|
IF (EXISTS (SELECT FROM pg_proc WHERE proname = 'interval_to_usec' AND pronamespace='_timescaledb_internal'::regnamespace))
|
|
THEN
|
|
PERFORM create_hypertable('hyper_timestamp'::regclass, 'time'::name, 'device_id'::name, number_partitions => 2, chunk_time_interval=> _timescaledb_internal.interval_to_usec('1 minute'));
|
|
ELSE
|
|
PERFORM create_hypertable('hyper_timestamp'::regclass, 'time'::name, 'device_id'::name, number_partitions => 2, chunk_time_interval=> _timescaledb_functions.interval_to_usec('1 minute'));
|
|
END IF;
|
|
END;
|
|
$$;
|
|
|
|
--some old versions use more slice_ids than newer ones. Make this uniform
|
|
CALL _timescaledb_testing.restart_dimension_slice_id();
|