Add _timescaledb_functions schema

Currently internal user objects like chunks and our functions
live in the same schema making locking down that schema hard.
This patch adds a new schema _timescaledb_functions that is meant
to be the schema used for timescaledb internal functions to
allow separation of code and chunks or other user objects.
This commit is contained in:
Sven Klemm 2023-03-31 08:22:57 +02:00 committed by Sven Klemm
parent 6440bb3477
commit feef9206fa
5 changed files with 11 additions and 1 deletions

View File

@ -5,11 +5,12 @@
SET LOCAL search_path TO pg_catalog, pg_temp;
CREATE SCHEMA _timescaledb_catalog;
CREATE SCHEMA _timescaledb_functions;
CREATE SCHEMA _timescaledb_internal;
CREATE SCHEMA _timescaledb_cache;
CREATE SCHEMA _timescaledb_config;
CREATE SCHEMA timescaledb_experimental;
CREATE SCHEMA timescaledb_information;
GRANT USAGE ON SCHEMA _timescaledb_cache, _timescaledb_catalog, _timescaledb_internal, _timescaledb_config, timescaledb_information, timescaledb_experimental TO PUBLIC;
GRANT USAGE ON SCHEMA _timescaledb_cache, _timescaledb_catalog, _timescaledb_functions, _timescaledb_internal, _timescaledb_config, timescaledb_information, timescaledb_experimental TO PUBLIC;

View File

@ -24,3 +24,7 @@ AS '@MODULE_PATHNAME@', 'ts_get_compressed_chunk_index_for_recompression' LANGUA
DROP FUNCTION _timescaledb_internal.dimension_is_finite;
DROP FUNCTION _timescaledb_internal.dimension_slice_get_constraint_sql;
CREATE SCHEMA _timescaledb_functions;
GRANT USAGE ON SCHEMA _timescaledb_functions TO PUBLIC;

View File

@ -99,3 +99,5 @@ BEGIN
END
$BODY$ SET search_path TO pg_catalog, pg_temp;
DROP SCHEMA _timescaledb_functions;

View File

@ -7,6 +7,7 @@
const char *const ts_extension_schema_names[] = {
[TS_CATALOG_SCHEMA] = CATALOG_SCHEMA_NAME,
[TS_FUNCTIONS_SCHEMA] = FUNCTIONS_SCHEMA_NAME,
[TS_INTERNAL_SCHEMA] = INTERNAL_SCHEMA_NAME,
[TS_CACHE_SCHEMA] = CACHE_SCHEMA_NAME,
[TS_CONFIG_SCHEMA] = CONFIG_SCHEMA_NAME,

View File

@ -24,6 +24,7 @@
typedef enum TsExtensionSchemas
{
TS_CATALOG_SCHEMA,
TS_FUNCTIONS_SCHEMA,
TS_INTERNAL_SCHEMA,
TS_CACHE_SCHEMA,
TS_CONFIG_SCHEMA,
@ -35,6 +36,7 @@ typedef enum TsExtensionSchemas
#define NUM_TIMESCALEDB_SCHEMAS _TS_MAX_SCHEMA
#define CATALOG_SCHEMA_NAME "_timescaledb_catalog"
#define FUNCTIONS_SCHEMA_NAME "_timescaledb_functions"
#define INTERNAL_SCHEMA_NAME "_timescaledb_internal"
#define CACHE_SCHEMA_NAME "_timescaledb_cache"
#define CONFIG_SCHEMA_NAME "_timescaledb_config"