Change error message for disabled feature flags

This intentionally doesnt follow the postgres guidelines for message and
detail because by default users won't see the detail and we want to
present a clear message without requiring enabling additional verbosity.
This commit is contained in:
Sven Klemm 2024-04-24 10:34:22 +02:00 committed by Sven Klemm
parent 6b4e6c9c55
commit ae7a73abb0
2 changed files with 21 additions and 21 deletions

View File

@ -178,8 +178,8 @@ ts_feature_flag_check(FeatureFlagType type)
return; return;
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("this feature is disabled"), errmsg("You are using a Dynamic PostgreSQL service. This feature is only available on "
errdetail("Feature flag \"%s\" is off", flag->name))); "Time-series services. https://tsdb.co/dynamic-postgresql")));
} }
/* /*

View File

@ -13,7 +13,7 @@ SET timescaledb.enable_hypertable_create TO off;
CREATE TABLE test(time timestamptz, device int); CREATE TABLE test(time timestamptz, device int);
\set ON_ERROR_STOP 0 \set ON_ERROR_STOP 0
SELECT * FROM create_hypertable('test', 'time'); SELECT * FROM create_hypertable('test', 'time');
ERROR: this feature is disabled ERROR: You are using a Dynamic PostgreSQL service. This feature is only available on Time-series services. https://tsdb.co/dynamic-postgresql
\set ON_ERROR_STOP 1 \set ON_ERROR_STOP 1
SET timescaledb.enable_hypertable_create TO on; SET timescaledb.enable_hypertable_create TO on;
SELECT * FROM create_hypertable('test', 'time'); SELECT * FROM create_hypertable('test', 'time');
@ -42,7 +42,7 @@ SELECT * FROM show_chunks('test');
-- compress_chunk -- compress_chunk
\set ON_ERROR_STOP 0 \set ON_ERROR_STOP 0
SELECT compress_chunk('_timescaledb_internal._hyper_1_1_chunk'); SELECT compress_chunk('_timescaledb_internal._hyper_1_1_chunk');
ERROR: this feature is disabled ERROR: You are using a Dynamic PostgreSQL service. This feature is only available on Time-series services. https://tsdb.co/dynamic-postgresql
\set ON_ERROR_STOP 1 \set ON_ERROR_STOP 1
SET timescaledb.enable_hypertable_compression TO on; SET timescaledb.enable_hypertable_compression TO on;
-- ensure compression cannot be enabled -- ensure compression cannot be enabled
@ -67,14 +67,14 @@ SET timescaledb.enable_hypertable_compression TO off;
-- cannot alter compressed table -- cannot alter compressed table
\set ON_ERROR_STOP 0 \set ON_ERROR_STOP 0
ALTER TABLE test ADD COLUMN col1 boolean DEFAULT false NOT NULL; ALTER TABLE test ADD COLUMN col1 boolean DEFAULT false NOT NULL;
ERROR: this feature is disabled ERROR: You are using a Dynamic PostgreSQL service. This feature is only available on Time-series services. https://tsdb.co/dynamic-postgresql
\set ON_ERROR_STOP 1 \set ON_ERROR_STOP 1
SET timescaledb.enable_hypertable_compression TO on; SET timescaledb.enable_hypertable_compression TO on;
ALTER TABLE test ADD COLUMN col1 boolean DEFAULT false NOT NULL; ALTER TABLE test ADD COLUMN col1 boolean DEFAULT false NOT NULL;
SET timescaledb.enable_hypertable_compression TO off; SET timescaledb.enable_hypertable_compression TO off;
\set ON_ERROR_STOP 0 \set ON_ERROR_STOP 0
ALTER TABLE test DROP COLUMN col1; ALTER TABLE test DROP COLUMN col1;
ERROR: this feature is disabled ERROR: You are using a Dynamic PostgreSQL service. This feature is only available on Time-series services. https://tsdb.co/dynamic-postgresql
\set ON_ERROR_STOP 1 \set ON_ERROR_STOP 1
-- cagg creation -- cagg creation
SHOW timescaledb.enable_cagg_create; SHOW timescaledb.enable_cagg_create;
@ -93,7 +93,7 @@ SELECT
FROM FROM
test test
GROUP BY hour, device; GROUP BY hour, device;
ERROR: this feature is disabled ERROR: You are using a Dynamic PostgreSQL service. This feature is only available on Time-series services. https://tsdb.co/dynamic-postgresql
\set ON_ERROR_STOP 1 \set ON_ERROR_STOP 1
SET timescaledb.enable_cagg_create TO on; SET timescaledb.enable_cagg_create TO on;
CREATE MATERIALIZED VIEW contagg CREATE MATERIALIZED VIEW contagg
@ -108,7 +108,7 @@ NOTICE: refreshing continuous aggregate "contagg"
SET timescaledb.enable_cagg_create TO off; SET timescaledb.enable_cagg_create TO off;
\set ON_ERROR_STOP 0 \set ON_ERROR_STOP 0
CALL refresh_continuous_aggregate('contagg', NULL, NULL); CALL refresh_continuous_aggregate('contagg', NULL, NULL);
ERROR: this feature is disabled ERROR: You are using a Dynamic PostgreSQL service. This feature is only available on Time-series services. https://tsdb.co/dynamic-postgresql
\set ON_ERROR_STOP 1 \set ON_ERROR_STOP 1
SET timescaledb.enable_cagg_create TO on; SET timescaledb.enable_cagg_create TO on;
-- policy creation -- policy creation
@ -121,30 +121,30 @@ SHOW timescaledb.enable_policy_create;
SET timescaledb.enable_policy_create TO off; SET timescaledb.enable_policy_create TO off;
\set ON_ERROR_STOP 0 \set ON_ERROR_STOP 0
select add_retention_policy('test', INTERVAL '4 months', true); select add_retention_policy('test', INTERVAL '4 months', true);
ERROR: this feature is disabled ERROR: You are using a Dynamic PostgreSQL service. This feature is only available on Time-series services. https://tsdb.co/dynamic-postgresql
select remove_retention_policy('test'); select remove_retention_policy('test');
ERROR: this feature is disabled ERROR: You are using a Dynamic PostgreSQL service. This feature is only available on Time-series services. https://tsdb.co/dynamic-postgresql
select add_compression_policy('test', compress_after => NULL); select add_compression_policy('test', compress_after => NULL);
ERROR: this feature is disabled ERROR: You are using a Dynamic PostgreSQL service. This feature is only available on Time-series services. https://tsdb.co/dynamic-postgresql
SELECT remove_compression_policy('test'); SELECT remove_compression_policy('test');
ERROR: this feature is disabled ERROR: You are using a Dynamic PostgreSQL service. This feature is only available on Time-series services. https://tsdb.co/dynamic-postgresql
SELECT add_continuous_aggregate_policy('contagg', '1 day'::interval, 10 , '1 h'::interval); SELECT add_continuous_aggregate_policy('contagg', '1 day'::interval, 10 , '1 h'::interval);
ERROR: this feature is disabled ERROR: You are using a Dynamic PostgreSQL service. This feature is only available on Time-series services. https://tsdb.co/dynamic-postgresql
SELECT remove_continuous_aggregate_policy('contagg'); SELECT remove_continuous_aggregate_policy('contagg');
ERROR: this feature is disabled ERROR: You are using a Dynamic PostgreSQL service. This feature is only available on Time-series services. https://tsdb.co/dynamic-postgresql
CREATE INDEX idx ON test(device); CREATE INDEX idx ON test(device);
SELECT add_reorder_policy('test', 'idx'); SELECT add_reorder_policy('test', 'idx');
ERROR: this feature is disabled ERROR: You are using a Dynamic PostgreSQL service. This feature is only available on Time-series services. https://tsdb.co/dynamic-postgresql
select remove_reorder_policy('test'); select remove_reorder_policy('test');
ERROR: this feature is disabled ERROR: You are using a Dynamic PostgreSQL service. This feature is only available on Time-series services. https://tsdb.co/dynamic-postgresql
SELECT timescaledb_experimental.add_policies('test', refresh_start_offset => 1, refresh_end_offset => 10, compress_after => 11, drop_after => 20); SELECT timescaledb_experimental.add_policies('test', refresh_start_offset => 1, refresh_end_offset => 10, compress_after => 11, drop_after => 20);
ERROR: this feature is disabled ERROR: You are using a Dynamic PostgreSQL service. This feature is only available on Time-series services. https://tsdb.co/dynamic-postgresql
SELECT timescaledb_experimental.show_policies('test'); SELECT timescaledb_experimental.show_policies('test');
ERROR: this feature is disabled ERROR: You are using a Dynamic PostgreSQL service. This feature is only available on Time-series services. https://tsdb.co/dynamic-postgresql
SELECT timescaledb_experimental.alter_policies('test', refresh_start_offset => 11, compress_after=>13, drop_after => 25); SELECT timescaledb_experimental.alter_policies('test', refresh_start_offset => 11, compress_after=>13, drop_after => 25);
ERROR: this feature is disabled ERROR: You are using a Dynamic PostgreSQL service. This feature is only available on Time-series services. https://tsdb.co/dynamic-postgresql
SELECT timescaledb_experimental.remove_all_policies('test'); SELECT timescaledb_experimental.remove_all_policies('test');
ERROR: this feature is disabled ERROR: You are using a Dynamic PostgreSQL service. This feature is only available on Time-series services. https://tsdb.co/dynamic-postgresql
SELECT timescaledb_experimental.remove_policies('test', false, 'policy_refresh_continuous_aggregate', 'policy_compression'); SELECT timescaledb_experimental.remove_policies('test', false, 'policy_refresh_continuous_aggregate', 'policy_compression');
ERROR: this feature is disabled ERROR: You are using a Dynamic PostgreSQL service. This feature is only available on Time-series services. https://tsdb.co/dynamic-postgresql
\set ON_ERROR_STOP 1 \set ON_ERROR_STOP 1