timescaledb/test/sql/updates/pre.testing.sql
Sven Klemm 28c7457faf Move scheduler functions to _timescaledb_functions schema
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:

- restart_background_workers()
- stop_background_workers()
- start_background_workers()
- alter_job_set_hypertable_id(integer,regclass)
2023-08-28 14:21:11 +02:00

26 lines
853 B
PL/PgSQL

-- 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.
-- These functions are used when running normal update tests.
CREATE SCHEMA IF NOT EXISTS _timescaledb_testing;
CREATE OR REPLACE PROCEDURE _timescaledb_testing.restart_dimension_slice_id()
LANGUAGE SQL
AS $$
ALTER SEQUENCE _timescaledb_catalog.dimension_slice_id_seq RESTART WITH 100;
$$;
CREATE OR REPLACE PROCEDURE _timescaledb_testing.stop_workers()
LANGUAGE PLPGSQL
AS $$
BEGIN
IF EXISTS (SELECT FROM pg_proc WHERE proname='stop_background_workers' AND pronamespace='_timescaledb_internal'::regnamespace)
THEN PERFORM _timescaledb_internal.stop_background_workers();
ELSE PERFORM _timescaledb_functions.stop_background_workers();
END IF;
END
$$;