Add extension namespace macro

There is a mix of macros for extension namespace and hard-coded
extension name in the code. This commit adds an `EXTENSION_NAMESPACE`
macro to `extension_constants.h` and uses that instead of locally
defined macros and hard-coded strings. It also adds a macro
`EXTENSION_OPTION` which can be used to create a full name for an
extension option using the namespace macro.
This commit is contained in:
Mats Kindahl 2024-02-20 08:08:30 +01:00 committed by Mats Kindahl
parent 72992d0ff0
commit ea9503b07a
14 changed files with 68 additions and 64 deletions

View File

@ -12,6 +12,7 @@
#include "debug_guc.h" #include "debug_guc.h"
#include "debug_assert.h" #include "debug_assert.h"
#include "extension_constants.h"
TSDLLEXPORT DebugOptimizerFlags ts_debug_optimizer_flags; TSDLLEXPORT DebugOptimizerFlags ts_debug_optimizer_flags;
@ -212,7 +213,7 @@ void
ts_debug_init(void) ts_debug_init(void)
{ {
static char *debug_optimizer_flags_string = NULL; static char *debug_optimizer_flags_string = NULL;
DefineCustomStringVariable("timescaledb.debug_optimizer_flags", DefineCustomStringVariable(MAKE_EXTOPTION("debug_optimizer_flags"),
"List of optimizer debug flags", "List of optimizer debug flags",
"A list of flags for configuring the optimizer debug output.", "A list of flags for configuring the optimizer debug output.",
&debug_optimizer_flags_string, &debug_optimizer_flags_string,

View File

@ -31,7 +31,7 @@
#include "extension_utils.c" #include "extension_utils.c"
#include "compat/compat.h" #include "compat/compat.h"
#define TS_UPDATE_SCRIPT_CONFIG_VAR "timescaledb.update_script_stage" #define TS_UPDATE_SCRIPT_CONFIG_VAR MAKE_EXTOPTION("update_script_stage")
#define POST_UPDATE "post" #define POST_UPDATE "post"
/* /*
* The name of the experimental schema. * The name of the experimental schema.

View File

@ -8,13 +8,16 @@
/* No function definitions here, only potentially globally available defines as this is used by the /* No function definitions here, only potentially globally available defines as this is used by the
* loader*/ * loader*/
#define EXTENSION_NAME "timescaledb" #define EXTENSION_NAME "timescaledb" /* Name of the actual extension */
#define EXTENSION_NAMESPACE "timescaledb" /* Namespace for extension objects */
#define EXTENSION_FDW_NAME "timescaledb_fdw" #define EXTENSION_FDW_NAME "timescaledb_fdw"
#define TSL_LIBRARY_NAME "timescaledb-tsl" #define TSL_LIBRARY_NAME "timescaledb-tsl"
#define TS_LIBDIR "$libdir/" #define TS_LIBDIR "$libdir/"
#define EXTENSION_SO TS_LIBDIR "" EXTENSION_NAME #define EXTENSION_SO TS_LIBDIR "" EXTENSION_NAME
#define EXTENSION_TSL_SO TS_LIBDIR TSL_LIBRARY_NAME "-" TIMESCALEDB_VERSION_MOD #define EXTENSION_TSL_SO TS_LIBDIR TSL_LIBRARY_NAME "-" TIMESCALEDB_VERSION_MOD
#define MAKE_EXTOPTION(NAME) (EXTENSION_NAMESPACE "." NAME)
#define MAX_VERSION_LEN (NAMEDATALEN + 1) #define MAX_VERSION_LEN (NAMEDATALEN + 1)
#define MAX_SO_NAME_LEN \ #define MAX_SO_NAME_LEN \
(8 + NAMEDATALEN + 1 + MAX_VERSION_LEN) /* "$libdir/"+extname+"-"+version \ (8 + NAMEDATALEN + 1 + MAX_VERSION_LEN) /* "$libdir/"+extname+"-"+version \
@ -44,4 +47,4 @@ typedef enum TsExtensionSchemas
extern const char *const ts_extension_schema_names[]; extern const char *const ts_extension_schema_names[];
#define RENDEZVOUS_BGW_LOADER_API_VERSION "timescaledb.bgw_loader_api_version" #define RENDEZVOUS_BGW_LOADER_API_VERSION MAKE_EXTOPTION("bgw_loader_api_version")

View File

@ -32,7 +32,7 @@
#define EXTENSION_PROXY_TABLE "cache_inval_extension" #define EXTENSION_PROXY_TABLE "cache_inval_extension"
#define RENDEZVOUS_LOADER_PRESENT_NAME "timescaledb.loader_present" #define RENDEZVOUS_LOADER_PRESENT_NAME MAKE_EXTOPTION("loader_present")
enum ExtensionState enum ExtensionState
{ {
@ -179,7 +179,7 @@ extension_load_without_preload()
{ {
/* cannot use GUC variable here since extension not yet loaded */ /* cannot use GUC variable here since extension not yet loaded */
char *allow_install_without_preload = char *allow_install_without_preload =
GetConfigOptionByName("timescaledb.allow_install_without_preload", NULL, true); GetConfigOptionByName(MAKE_EXTOPTION("allow_install_without_preload"), NULL, true);
if (allow_install_without_preload == NULL || strcmp(allow_install_without_preload, "on") != 0) if (allow_install_without_preload == NULL || strcmp(allow_install_without_preload, "on") != 0)
{ {

View File

@ -120,19 +120,19 @@ typedef struct
} FeatureFlag; } FeatureFlag;
static FeatureFlag ts_feature_flags[] = { static FeatureFlag ts_feature_flags[] = {
[FEATURE_HYPERTABLE] = { "timescaledb.enable_hypertable_create", [FEATURE_HYPERTABLE] = { MAKE_EXTOPTION("enable_hypertable_create"),
"Enable creation of hypertable", "Enable creation of hypertable",
&ts_guc_enable_hypertable_create }, &ts_guc_enable_hypertable_create },
[FEATURE_HYPERTABLE_COMPRESSION] = { "timescaledb.enable_hypertable_compression", [FEATURE_HYPERTABLE_COMPRESSION] = { MAKE_EXTOPTION("enable_hypertable_compression"),
"Enable hypertable compression functions", "Enable hypertable compression functions",
&ts_guc_enable_hypertable_compression }, &ts_guc_enable_hypertable_compression },
[FEATURE_CAGG] = { "timescaledb.enable_cagg_create", [FEATURE_CAGG] = { MAKE_EXTOPTION("enable_cagg_create"),
"Enable creation of continuous aggregate", "Enable creation of continuous aggregate",
&ts_guc_enable_cagg_create }, &ts_guc_enable_cagg_create },
[FEATURE_POLICY] = { "timescaledb.enable_policy_create", [FEATURE_POLICY] = { MAKE_EXTOPTION("enable_policy_create"),
"Enable creation of policies and user-defined actions", "Enable creation of policies and user-defined actions",
&ts_guc_enable_policy_create } &ts_guc_enable_policy_create }
}; };
@ -218,7 +218,7 @@ assign_max_open_chunks_per_insert_hook(int newval, void *extra)
void void
_guc_init(void) _guc_init(void)
{ {
DefineCustomBoolVariable("timescaledb.enable_deprecation_warnings", DefineCustomBoolVariable(MAKE_EXTOPTION("enable_deprecation_warnings"),
"Enable warnings when using deprecated functionality", "Enable warnings when using deprecated functionality",
NULL, NULL,
&ts_guc_enable_deprecation_warnings, &ts_guc_enable_deprecation_warnings,
@ -229,7 +229,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomBoolVariable("timescaledb.enable_optimizations", DefineCustomBoolVariable(MAKE_EXTOPTION("enable_optimizations"),
"Enable TimescaleDB query optimizations", "Enable TimescaleDB query optimizations",
NULL, NULL,
&ts_guc_enable_optimizations, &ts_guc_enable_optimizations,
@ -240,7 +240,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomBoolVariable("timescaledb.restoring", DefineCustomBoolVariable(MAKE_EXTOPTION("restoring"),
"Install timescale in restoring mode", "Install timescale in restoring mode",
"Used for running pg_restore", "Used for running pg_restore",
&ts_guc_restoring, &ts_guc_restoring,
@ -251,7 +251,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomBoolVariable("timescaledb.enable_constraint_aware_append", DefineCustomBoolVariable(MAKE_EXTOPTION("enable_constraint_aware_append"),
"Enable constraint-aware append scans", "Enable constraint-aware append scans",
"Enable constraint exclusion at execution time", "Enable constraint exclusion at execution time",
&ts_guc_enable_constraint_aware_append, &ts_guc_enable_constraint_aware_append,
@ -262,7 +262,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomBoolVariable("timescaledb.enable_ordered_append", DefineCustomBoolVariable(MAKE_EXTOPTION("enable_ordered_append"),
"Enable ordered append scans", "Enable ordered append scans",
"Enable ordered append optimization for queries that are ordered by " "Enable ordered append optimization for queries that are ordered by "
"the time dimension", "the time dimension",
@ -274,7 +274,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomBoolVariable("timescaledb.enable_chunk_append", DefineCustomBoolVariable(MAKE_EXTOPTION("enable_chunk_append"),
"Enable chunk append node", "Enable chunk append node",
"Enable using chunk append node", "Enable using chunk append node",
&ts_guc_enable_chunk_append, &ts_guc_enable_chunk_append,
@ -285,7 +285,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomBoolVariable("timescaledb.enable_parallel_chunk_append", DefineCustomBoolVariable(MAKE_EXTOPTION("enable_parallel_chunk_append"),
"Enable parallel chunk append node", "Enable parallel chunk append node",
"Enable using parallel aware chunk append node", "Enable using parallel aware chunk append node",
&ts_guc_enable_parallel_chunk_append, &ts_guc_enable_parallel_chunk_append,
@ -296,7 +296,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomBoolVariable("timescaledb.enable_runtime_exclusion", DefineCustomBoolVariable(MAKE_EXTOPTION("enable_runtime_exclusion"),
"Enable runtime chunk exclusion", "Enable runtime chunk exclusion",
"Enable runtime chunk exclusion in ChunkAppend node", "Enable runtime chunk exclusion in ChunkAppend node",
&ts_guc_enable_runtime_exclusion, &ts_guc_enable_runtime_exclusion,
@ -307,7 +307,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomBoolVariable("timescaledb.enable_constraint_exclusion", DefineCustomBoolVariable(MAKE_EXTOPTION("enable_constraint_exclusion"),
"Enable constraint exclusion", "Enable constraint exclusion",
"Enable planner constraint exclusion", "Enable planner constraint exclusion",
&ts_guc_enable_constraint_exclusion, &ts_guc_enable_constraint_exclusion,
@ -318,7 +318,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomBoolVariable("timescaledb.enable_qual_propagation", DefineCustomBoolVariable(MAKE_EXTOPTION("enable_qual_propagation"),
"Enable qualifier propagation", "Enable qualifier propagation",
"Enable propagation of qualifiers in JOINs", "Enable propagation of qualifiers in JOINs",
&ts_guc_enable_qual_propagation, &ts_guc_enable_qual_propagation,
@ -329,7 +329,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomBoolVariable("timescaledb.enable_dml_decompression", DefineCustomBoolVariable(MAKE_EXTOPTION("enable_dml_decompression"),
"Enable DML decompression", "Enable DML decompression",
"Enable DML decompression when modifying compressed hypertable", "Enable DML decompression when modifying compressed hypertable",
&ts_guc_enable_dml_decompression, &ts_guc_enable_dml_decompression,
@ -340,7 +340,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomIntVariable("timescaledb.max_tuples_decompressed_per_dml_transaction", DefineCustomIntVariable(MAKE_EXTOPTION("max_tuples_decompressed_per_dml_transaction"),
"The max number of tuples that can be decompressed during an " "The max number of tuples that can be decompressed during an "
"INSERT, UPDATE, or DELETE.", "INSERT, UPDATE, or DELETE.",
" If the number of tuples exceeds this value, an error will " " If the number of tuples exceeds this value, an error will "
@ -357,7 +357,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomBoolVariable("timescaledb.enable_transparent_decompression", DefineCustomBoolVariable(MAKE_EXTOPTION("enable_transparent_decompression"),
"Enable transparent decompression", "Enable transparent decompression",
"Enable transparent decompression when querying hypertable", "Enable transparent decompression when querying hypertable",
&ts_guc_enable_transparent_decompression, &ts_guc_enable_transparent_decompression,
@ -368,7 +368,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomBoolVariable("timescaledb.enable_skipscan", DefineCustomBoolVariable(MAKE_EXTOPTION("enable_skipscan"),
"Enable SkipScan", "Enable SkipScan",
"Enable SkipScan for DISTINCT queries", "Enable SkipScan for DISTINCT queries",
&ts_guc_enable_skip_scan, &ts_guc_enable_skip_scan,
@ -379,7 +379,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomBoolVariable("timescaledb.enable_decompression_logrep_markers", DefineCustomBoolVariable(MAKE_EXTOPTION("enable_decompression_logrep_markers"),
"Enable logical replication markers for decompression ops", "Enable logical replication markers for decompression ops",
"Enable the generation of logical replication markers in the " "Enable the generation of logical replication markers in the "
"WAL stream to mark the start and end of decompressions (for insert, " "WAL stream to mark the start and end of decompressions (for insert, "
@ -392,7 +392,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomBoolVariable("timescaledb.enable_decompression_sorted_merge", DefineCustomBoolVariable(MAKE_EXTOPTION("enable_decompression_sorted_merge"),
"Enable compressed batches heap merge", "Enable compressed batches heap merge",
"Enable the merge of compressed batches to preserve the compression " "Enable the merge of compressed batches to preserve the compression "
"order by", "order by",
@ -404,7 +404,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomBoolVariable("timescaledb.enable_cagg_reorder_groupby", DefineCustomBoolVariable(MAKE_EXTOPTION("enable_cagg_reorder_groupby"),
"Enable group by reordering", "Enable group by reordering",
"Enable group by clause reordering for continuous aggregates", "Enable group by clause reordering for continuous aggregates",
&ts_guc_enable_cagg_reorder_groupby, &ts_guc_enable_cagg_reorder_groupby,
@ -415,7 +415,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomBoolVariable("timescaledb.enable_now_constify", DefineCustomBoolVariable(MAKE_EXTOPTION("enable_now_constify"),
"Enable now() constify", "Enable now() constify",
"Enable constifying now() in query constraints", "Enable constifying now() in query constraints",
&ts_guc_enable_now_constify, &ts_guc_enable_now_constify,
@ -426,7 +426,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomBoolVariable("timescaledb.enable_cagg_watermark_constify", DefineCustomBoolVariable(MAKE_EXTOPTION("enable_cagg_watermark_constify"),
"Enable cagg watermark constify", "Enable cagg watermark constify",
"Enable constifying cagg watermark for real-time caggs", "Enable constifying cagg watermark for real-time caggs",
&ts_guc_enable_cagg_watermark_constify, &ts_guc_enable_cagg_watermark_constify,
@ -437,7 +437,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomBoolVariable("timescaledb.enable_tiered_reads", DefineCustomBoolVariable(MAKE_EXTOPTION("enable_tiered_reads"),
"Enable tiered data reads", "Enable tiered data reads",
"Enable reading of tiered data by including a foreign table " "Enable reading of tiered data by including a foreign table "
"representing the data in the object storage into the query plan", "representing the data in the object storage into the query plan",
@ -449,7 +449,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomBoolVariable("timescaledb.enable_async_append", DefineCustomBoolVariable(MAKE_EXTOPTION("enable_async_append"),
"Enable async query execution on data nodes", "Enable async query execution on data nodes",
"Enable optimization that runs remote queries asynchronously" "Enable optimization that runs remote queries asynchronously"
"across data nodes", "across data nodes",
@ -461,7 +461,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomBoolVariable("timescaledb.enable_chunkwise_aggregation", DefineCustomBoolVariable(MAKE_EXTOPTION("enable_chunkwise_aggregation"),
"Enable chunk-wise aggregation", "Enable chunk-wise aggregation",
"Enable the pushdown of aggregations to the" "Enable the pushdown of aggregations to the"
" chunk level", " chunk level",
@ -473,7 +473,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomBoolVariable("timescaledb.enable_vectorized_aggregation", DefineCustomBoolVariable(MAKE_EXTOPTION("enable_vectorized_aggregation"),
"Enable vectorized aggregation", "Enable vectorized aggregation",
"Enable vectorized aggregation for compressed data", "Enable vectorized aggregation for compressed data",
&ts_guc_enable_vectorized_aggregation, &ts_guc_enable_vectorized_aggregation,
@ -484,7 +484,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomBoolVariable("timescaledb.enable_compression_indexscan", DefineCustomBoolVariable(MAKE_EXTOPTION("enable_compression_indexscan"),
"Enable compression to take indexscan path", "Enable compression to take indexscan path",
"Enable indexscan during compression, if matching index is found", "Enable indexscan during compression, if matching index is found",
&ts_guc_enable_compression_indexscan, &ts_guc_enable_compression_indexscan,
@ -495,7 +495,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomBoolVariable("timescaledb.enable_bulk_decompression", DefineCustomBoolVariable(MAKE_EXTOPTION("enable_bulk_decompression"),
"Enable decompression of the entire compressed batches", "Enable decompression of the entire compressed batches",
"Increases throughput of decompression, but might increase query " "Increases throughput of decompression, but might increase query "
"memory usage", "memory usage",
@ -507,7 +507,7 @@ _guc_init(void)
NULL, NULL,
NULL); NULL);
DefineCustomIntVariable("timescaledb.max_open_chunks_per_insert", DefineCustomIntVariable(MAKE_EXTOPTION("max_open_chunks_per_insert"),
"Maximum open chunks per insert", "Maximum open chunks per insert",
"Maximum number of open chunk tables per insert", "Maximum number of open chunk tables per insert",
&ts_guc_max_open_chunks_per_insert, &ts_guc_max_open_chunks_per_insert,
@ -520,7 +520,7 @@ _guc_init(void)
assign_max_open_chunks_per_insert_hook, assign_max_open_chunks_per_insert_hook,
NULL); NULL);
DefineCustomIntVariable("timescaledb.max_cached_chunks_per_hypertable", DefineCustomIntVariable(MAKE_EXTOPTION("max_cached_chunks_per_hypertable"),
"Maximum cached chunks", "Maximum cached chunks",
"Maximum number of chunks stored in the cache", "Maximum number of chunks stored in the cache",
&ts_guc_max_cached_chunks_per_hypertable, &ts_guc_max_cached_chunks_per_hypertable,
@ -533,7 +533,7 @@ _guc_init(void)
assign_max_cached_chunks_per_hypertable_hook, assign_max_cached_chunks_per_hypertable_hook,
NULL); NULL);
#ifdef USE_TELEMETRY #ifdef USE_TELEMETRY
DefineCustomEnumVariable("timescaledb.telemetry_level", DefineCustomEnumVariable(MAKE_EXTOPTION("telemetry_level"),
"Telemetry settings level", "Telemetry settings level",
"Level used to determine which telemetry to send", "Level used to determine which telemetry to send",
(int *) &ts_guc_telemetry_level, (int *) &ts_guc_telemetry_level,
@ -546,7 +546,7 @@ _guc_init(void)
NULL); NULL);
#endif #endif
DefineCustomStringVariable(/* name= */ "timescaledb.license", DefineCustomStringVariable(/* name= */ MAKE_EXTOPTION("license"),
/* short_desc= */ "TimescaleDB license type", /* short_desc= */ "TimescaleDB license type",
/* long_desc= */ "Determines which features are enabled", /* long_desc= */ "Determines which features are enabled",
/* valueAddr= */ &ts_guc_license, /* valueAddr= */ &ts_guc_license,
@ -557,7 +557,7 @@ _guc_init(void)
/* assign_hook= */ ts_license_guc_assign_hook, /* assign_hook= */ ts_license_guc_assign_hook,
/* show_hook= */ NULL); /* show_hook= */ NULL);
DefineCustomStringVariable(/* name= */ "timescaledb.last_tuned", DefineCustomStringVariable(/* name= */ MAKE_EXTOPTION("last_tuned"),
/* short_desc= */ "last tune run", /* short_desc= */ "last tune run",
/* long_desc= */ "records last time timescaledb-tune ran", /* long_desc= */ "records last time timescaledb-tune ran",
/* valueAddr= */ &ts_last_tune_time, /* valueAddr= */ &ts_last_tune_time,
@ -568,7 +568,7 @@ _guc_init(void)
/* assign_hook= */ NULL, /* assign_hook= */ NULL,
/* show_hook= */ NULL); /* show_hook= */ NULL);
DefineCustomStringVariable(/* name= */ "timescaledb.last_tuned_version", DefineCustomStringVariable(/* name= */ MAKE_EXTOPTION("last_tuned_version"),
/* short_desc= */ "version of timescaledb-tune", /* short_desc= */ "version of timescaledb-tune",
/* long_desc= */ "version of timescaledb-tune used to tune", /* long_desc= */ "version of timescaledb-tune used to tune",
/* valueAddr= */ &ts_last_tune_version, /* valueAddr= */ &ts_last_tune_version,
@ -579,7 +579,7 @@ _guc_init(void)
/* assign_hook= */ NULL, /* assign_hook= */ NULL,
/* show_hook= */ NULL); /* show_hook= */ NULL);
DefineCustomEnumVariable("timescaledb.bgw_log_level", DefineCustomEnumVariable(MAKE_EXTOPTION("bgw_log_level"),
"Log level for the background worker subsystem", "Log level for the background worker subsystem",
"Log level for the scheduler and workers of the background worker " "Log level for the scheduler and workers of the background worker "
"subsystem. Requires configuration reload to change.", "subsystem. Requires configuration reload to change.",
@ -593,7 +593,7 @@ _guc_init(void)
NULL); NULL);
/* this information is useful in general on customer deployments */ /* this information is useful in general on customer deployments */
DefineCustomBoolVariable(/* name= */ "timescaledb.debug_compression_path_info", DefineCustomBoolVariable(/* name= */ MAKE_EXTOPTION("debug_compression_path_info"),
/* short_desc= */ "show various compression-related debug info", /* short_desc= */ "show various compression-related debug info",
/* long_desc= */ "this is for debugging/information purposes", /* long_desc= */ "this is for debugging/information purposes",
/* valueAddr= */ &ts_guc_debug_compression_path_info, /* valueAddr= */ &ts_guc_debug_compression_path_info,
@ -618,7 +618,7 @@ _guc_init(void)
#endif #endif
#ifdef TS_DEBUG #ifdef TS_DEBUG
DefineCustomBoolVariable(/* name= */ "timescaledb.shutdown_bgw_scheduler", DefineCustomBoolVariable(/* name= */ MAKE_EXTOPTION("shutdown_bgw_scheduler"),
/* short_desc= */ "immediately shutdown the bgw scheduler", /* short_desc= */ "immediately shutdown the bgw scheduler",
/* long_desc= */ "this is for debugging purposes", /* long_desc= */ "this is for debugging purposes",
/* valueAddr= */ &ts_shutdown_bgw, /* valueAddr= */ &ts_shutdown_bgw,
@ -629,7 +629,7 @@ _guc_init(void)
/* assign_hook= */ NULL, /* assign_hook= */ NULL,
/* show_hook= */ NULL); /* show_hook= */ NULL);
DefineCustomStringVariable(/* name= */ "timescaledb.current_timestamp_mock", DefineCustomStringVariable(/* name= */ MAKE_EXTOPTION("current_timestamp_mock"),
/* short_desc= */ "set the current timestamp", /* short_desc= */ "set the current timestamp",
/* long_desc= */ "this is for debugging purposes", /* long_desc= */ "this is for debugging purposes",
/* valueAddr= */ &ts_current_timestamp_mock, /* valueAddr= */ &ts_current_timestamp_mock,
@ -640,7 +640,7 @@ _guc_init(void)
/* assign_hook= */ NULL, /* assign_hook= */ NULL,
/* show_hook= */ NULL); /* show_hook= */ NULL);
DefineCustomEnumVariable(/* name= */ "timescaledb.debug_require_vector_qual", DefineCustomEnumVariable(/* name= */ MAKE_EXTOPTION("debug_require_vector_qual"),
/* short_desc= */ /* short_desc= */
"ensure that non-vectorized or vectorized filters are used in " "ensure that non-vectorized or vectorized filters are used in "
"DecompressChunk node", "DecompressChunk node",
@ -658,7 +658,7 @@ _guc_init(void)
/* assign_hook= */ NULL, /* assign_hook= */ NULL,
/* show_hook= */ NULL); /* show_hook= */ NULL);
DefineCustomBoolVariable(/* name= */ "timescaledb.debug_require_batch_sorted_merge", DefineCustomBoolVariable(/* name= */ MAKE_EXTOPTION("debug_require_batch_sorted_merge"),
/* short_desc= */ "require batch sorted merge in DecompressChunk node", /* short_desc= */ "require batch sorted merge in DecompressChunk node",
/* long_desc= */ "this is for debugging purposes", /* long_desc= */ "this is for debugging purposes",
/* valueAddr= */ &ts_guc_debug_require_batch_sorted_merge, /* valueAddr= */ &ts_guc_debug_require_batch_sorted_merge,

View File

@ -93,7 +93,7 @@ ts_license_enable_module_loading(void)
load_enabled = true; load_enabled = true;
/* re-set the license to actually load the submodule if needed */ /* re-set the license to actually load the submodule if needed */
result = set_config_option("timescaledb.license", result = set_config_option(MAKE_EXTOPTION("license"),
ts_guc_license, ts_guc_license,
PGC_SUSET, PGC_SUSET,
load_source, load_source,

View File

@ -16,6 +16,7 @@
#include <utils/guc.h> #include <utils/guc.h>
#include "bgw_counter.h" #include "bgw_counter.h"
#include "extension_constants.h"
#define BGW_COUNTER_STATE_NAME "ts_bgw_counter_state" #define BGW_COUNTER_STATE_NAME "ts_bgw_counter_state"
@ -60,7 +61,7 @@ bgw_counter_state_init()
extern void extern void
ts_bgw_counter_setup_gucs(void) ts_bgw_counter_setup_gucs(void)
{ {
DefineCustomIntVariable("timescaledb.max_background_workers", DefineCustomIntVariable(MAKE_EXTOPTION("max_background_workers"),
"Maximum background worker processes allocated to TimescaleDB", "Maximum background worker processes allocated to TimescaleDB",
"Max background worker processes allocated to TimescaleDB - set to at " "Max background worker processes allocated to TimescaleDB - set to at "
"least 1 + number of databases in Postgres instance to use background " "least 1 + number of databases in Postgres instance to use background "

View File

@ -83,7 +83,7 @@ PG_MODULE_MAGIC;
#endif #endif
#define POST_LOAD_INIT_FN "ts_post_load_init" #define POST_LOAD_INIT_FN "ts_post_load_init"
#define GUC_LAUNCHER_POLL_TIME_MS "timescaledb.bgw_launcher_poll_time" #define GUC_LAUNCHER_POLL_TIME_MS MAKE_EXTOPTION("bgw_launcher_poll_time")
/* /*
* The loader really shouldn't load if we're in a parallel worker as there is a * The loader really shouldn't load if we're in a parallel worker as there is a
@ -146,10 +146,10 @@ TsExtension extensions[] = {
/* Redundant default initializers are here because we compile with /* Redundant default initializers are here because we compile with
* `-Werror -Wmissing-field-initializers` for our PG13 build... */ * `-Werror -Wmissing-field-initializers` for our PG13 build... */
{ {
.name = "timescaledb", .name = EXTENSION_NAME,
.schema_name = CACHE_SCHEMA_NAME, .schema_name = CACHE_SCHEMA_NAME,
.table_name = EXTENSION_PROXY_TABLE, .table_name = EXTENSION_PROXY_TABLE,
.guc_disable_load_name = "timescaledb.disable_load", .guc_disable_load_name = MAKE_EXTOPTION("disable_load"),
.guc_disable_load = false, .guc_disable_load = false,
.soversion = "", .soversion = "",
.post_parse_analyze_hook = NULL, .post_parse_analyze_hook = NULL,
@ -699,9 +699,9 @@ do_load(TsExtension *const ext)
* loader was preloaded, newer versions use rendezvous variables instead. * loader was preloaded, newer versions use rendezvous variables instead.
*/ */
if ((strcmp(version, "0.9.0") == 0 || strcmp(version, "0.9.1") == 0) && if ((strcmp(version, "0.9.0") == 0 || strcmp(version, "0.9.1") == 0) &&
strcmp(ext->name, "timescaledb") == 0) strcmp(ext->name, EXTENSION_NAME) == 0)
{ {
SetConfigOption("timescaledb.loader_present", "on", PGC_USERSET, PGC_S_SESSION); SetConfigOption(MAKE_EXTOPTION("loader_present"), "on", PGC_USERSET, PGC_S_SESSION);
} }
/* /*

View File

@ -715,7 +715,7 @@ add_function_call_telemetry(JsonbParseState *state)
return; return;
} }
visible_extensions[0] = "timescaledb"; visible_extensions[0] = EXTENSION_NAME;
for (size_t i = 1; i < sizeof(visible_extensions) / sizeof(char *); i++) for (size_t i = 1; i < sizeof(visible_extensions) / sizeof(char *); i++)
visible_extensions[i] = related_extensions[i - 1]; visible_extensions[i] = related_extensions[i - 1];

View File

@ -125,7 +125,7 @@ ts_continuous_agg_get_compression_defelems(const WithClauseResult *with_clauses)
if (!input->is_default) if (!input->is_default)
{ {
Node *value = (Node *) makeString(ts_with_clause_result_deparse_value(input)); Node *value = (Node *) makeString(ts_with_clause_result_deparse_value(input));
DefElem *elem = makeDefElemExtended("timescaledb", DefElem *elem = makeDefElemExtended(EXTENSION_NAMESPACE,
(char *) def.arg_name, (char *) def.arg_name,
value, value,
DEFELEM_UNSPEC, DEFELEM_UNSPEC,

View File

@ -15,10 +15,9 @@
#include <utils/syscache.h> #include <utils/syscache.h>
#include "debug_assert.h" #include "debug_assert.h"
#include "extension_constants.h"
#include "with_clause_parser.h" #include "with_clause_parser.h"
#define TIMESCALEDB_NAMESPACE "timescaledb"
/* /*
* Filter a list of DefElem based on a namespace. * Filter a list of DefElem based on a namespace.
* This function will iterate through DefElem and output up to two lists: * This function will iterate through DefElem and output up to two lists:
@ -41,8 +40,7 @@ ts_with_clause_filter(const List *def_elems, List **within_namespace, List **not
{ {
DefElem *def = (DefElem *) lfirst(cell); DefElem *def = (DefElem *) lfirst(cell);
if (def->defnamespace != NULL && if (def->defnamespace != NULL && pg_strcasecmp(def->defnamespace, EXTENSION_NAMESPACE) == 0)
pg_strcasecmp(def->defnamespace, TIMESCALEDB_NAMESPACE) == 0)
{ {
if (within_namespace != NULL) if (within_namespace != NULL)
*within_namespace = lappend(*within_namespace, def); *within_namespace = lappend(*within_namespace, def);

View File

@ -20,6 +20,7 @@
#include <utils/memutils.h> #include <utils/memutils.h>
#include "debug_point.h" #include "debug_point.h"
#include "extension_constants.h"
TS_FUNCTION_INFO_V1(ts_test_error_injection); TS_FUNCTION_INFO_V1(ts_test_error_injection);
TS_FUNCTION_INFO_V1(ts_debug_shippable_error_after_n_rows); TS_FUNCTION_INFO_V1(ts_debug_shippable_error_after_n_rows);
@ -139,7 +140,7 @@ get_error_after_rows()
int error_after = 7103; /* default is an arbitrary prime */ int error_after = 7103; /* default is an arbitrary prime */
const char *error_after_option = const char *error_after_option =
GetConfigOption("timescaledb.debug_broken_sendrecv_error_after", true, false); GetConfigOption(MAKE_EXTOPTION("debug_broken_sendrecv_error_after"), true, false);
if (error_after_option) if (error_after_option)
{ {
error_after = pg_strtoint32(error_after_option); error_after = pg_strtoint32(error_after_option);

View File

@ -172,7 +172,7 @@ cagg_get_compression_params(ContinuousAgg *agg, Hypertable *mat_ht)
List *defelems = NIL; List *defelems = NIL;
const Dimension *mat_ht_dim = hyperspace_get_open_dimension(mat_ht->space, 0); const Dimension *mat_ht_dim = hyperspace_get_open_dimension(mat_ht->space, 0);
const char *mat_ht_timecolname = quote_identifier(NameStr(mat_ht_dim->fd.column_name)); const char *mat_ht_timecolname = quote_identifier(NameStr(mat_ht_dim->fd.column_name));
DefElem *ordby = makeDefElemExtended("timescaledb", DefElem *ordby = makeDefElemExtended(EXTENSION_NAMESPACE,
"compress_orderby", "compress_orderby",
(Node *) makeString((char *) mat_ht_timecolname), (Node *) makeString((char *) mat_ht_timecolname),
DEFELEM_UNSPEC, DEFELEM_UNSPEC,
@ -197,7 +197,7 @@ cagg_get_compression_params(ContinuousAgg *agg, Hypertable *mat_ht)
if (info->len > 0) if (info->len > 0)
{ {
DefElem *segby; DefElem *segby;
segby = makeDefElemExtended("timescaledb", segby = makeDefElemExtended(EXTENSION_NAMESPACE,
"compress_segmentby", "compress_segmentby",
(Node *) makeString(info->data), (Node *) makeString(info->data),
DEFELEM_UNSPEC, DEFELEM_UNSPEC,

View File

@ -350,7 +350,7 @@ materialization_per_refresh_window(void)
{ {
#define DEFAULT_MATERIALIZATIONS_PER_REFRESH_WINDOW 10 #define DEFAULT_MATERIALIZATIONS_PER_REFRESH_WINDOW 10
#define MATERIALIZATIONS_PER_REFRESH_WINDOW_OPT_NAME \ #define MATERIALIZATIONS_PER_REFRESH_WINDOW_OPT_NAME \
"timescaledb.materializations_per_refresh_window" MAKE_EXTOPTION("materializations_per_refresh_window")
const char *max_materializations_setting = const char *max_materializations_setting =
GetConfigOption(MATERIALIZATIONS_PER_REFRESH_WINDOW_OPT_NAME, true, false); GetConfigOption(MATERIALIZATIONS_PER_REFRESH_WINDOW_OPT_NAME, true, false);