Skip to content

Commit a3808dc

Browse files
committed
Remove time_bucket_ng function
1 parent a465f3f commit a3808dc

40 files changed

+71
-11369
lines changed

.unreleased/pr_8229

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Implements: #8229 Removed `time_bucket_ng` function

cmake/ScriptFiles.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ set(SOURCE_FILES
3939
ddl_triggers.sql
4040
bookend.sql
4141
time_bucket.sql
42-
time_bucket_ng.sql
4342
version.sql
4443
size_utils.sql
4544
histogram.sql

sql/cagg_migrate.sql

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,3 @@ BEGIN
670670
END;
671671
$BODY$;
672672

673-
-- Migrate a CAgg which is using the experimental time_bucket_ng function
674-
-- into a CAgg using the regular time_bucket function
675-
CREATE OR REPLACE PROCEDURE _timescaledb_functions.cagg_migrate_to_time_bucket(cagg REGCLASS)
676-
AS '@MODULE_PATHNAME@', 'ts_continuous_agg_migrate_to_time_bucket' LANGUAGE C;

sql/time_bucket_ng.sql

Lines changed: 0 additions & 60 deletions
This file was deleted.

sql/updates/latest-dev.sql

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ $$ LANGUAGE PLPGSQL;
4646
-- chunk_id.
4747
ALTER TABLE _timescaledb_catalog.chunk_column_stats ALTER COLUMN chunk_id DROP NOT NULL;
4848
UPDATE _timescaledb_catalog.chunk_column_stats SET chunk_id = NULL WHERE chunk_id = 0;
49+
4950
DROP PROCEDURE @[email protected]_continuous_aggregate(
5051
continuous_aggregate REGCLASS,
5152
window_start "any",
@@ -60,3 +61,21 @@ CREATE PROCEDURE @[email protected]_continuous_aggregate(
6061
force BOOLEAN = FALSE,
6162
options JSONB = NULL
6263
) LANGUAGE C AS '@MODULE_PATHNAME@', 'ts_update_placeholder';
64+
65+
DROP FUNCTION timescaledb_experimental.time_bucket_ng(bucket_width INTERVAL, ts DATE);
66+
67+
DROP FUNCTION timescaledb_experimental.time_bucket_ng(bucket_width INTERVAL, ts DATE, origin DATE);
68+
69+
DROP FUNCTION timescaledb_experimental.time_bucket_ng(bucket_width INTERVAL, ts TIMESTAMP);
70+
71+
DROP FUNCTION timescaledb_experimental.time_bucket_ng(bucket_width INTERVAL, ts TIMESTAMP, origin TIMESTAMP);
72+
73+
DROP FUNCTION timescaledb_experimental.time_bucket_ng(bucket_width INTERVAL, ts TIMESTAMPTZ, timezone TEXT);
74+
75+
DROP FUNCTION timescaledb_experimental.time_bucket_ng(bucket_width INTERVAL, ts TIMESTAMPTZ, origin TIMESTAMPTZ, timezone TEXT);
76+
77+
DROP FUNCTION timescaledb_experimental.time_bucket_ng(bucket_width INTERVAL, ts TIMESTAMPTZ);
78+
79+
DROP FUNCTION timescaledb_experimental.time_bucket_ng(bucket_width INTERVAL, ts TIMESTAMPTZ, origin TIMESTAMPTZ);
80+
81+
DROP PROCEDURE _timescaledb_functions.cagg_migrate_to_time_bucket(cagg REGCLASS);

sql/updates/reverse-dev.sql

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ END
4848
$$;
4949
DELETE FROM _timescaledb_catalog.chunk_column_stats WHERE chunk_id IS NULL;
5050
ALTER TABLE _timescaledb_catalog.chunk_column_stats ALTER COLUMN chunk_id SET NOT NULL;
51+
5152
DROP PROCEDURE @[email protected]_continuous_aggregate(
5253
continuous_aggregate REGCLASS,
5354
window_start "any",
@@ -62,3 +63,32 @@ CREATE PROCEDURE @[email protected]_continuous_aggregate(
6263
window_end "any",
6364
force BOOLEAN = FALSE
6465
) LANGUAGE C AS '@MODULE_PATHNAME@', 'ts_update_placeholder';
66+
67+
CREATE OR REPLACE FUNCTION timescaledb_experimental.time_bucket_ng(bucket_width INTERVAL, ts DATE) RETURNS DATE
68+
AS '@MODULE_PATHNAME@', 'ts_update_placeholder' LANGUAGE C IMMUTABLE PARALLEL SAFE STRICT;
69+
70+
CREATE OR REPLACE FUNCTION timescaledb_experimental.time_bucket_ng(bucket_width INTERVAL, ts DATE, origin DATE) RETURNS DATE
71+
AS '@MODULE_PATHNAME@', 'ts_update_placeholder' LANGUAGE C IMMUTABLE PARALLEL SAFE STRICT;
72+
73+
CREATE OR REPLACE FUNCTION timescaledb_experimental.time_bucket_ng(bucket_width INTERVAL, ts TIMESTAMP) RETURNS TIMESTAMP
74+
AS '@MODULE_PATHNAME@', 'ts_update_placeholder' LANGUAGE C IMMUTABLE PARALLEL SAFE STRICT;
75+
76+
CREATE OR REPLACE FUNCTION timescaledb_experimental.time_bucket_ng(bucket_width INTERVAL, ts TIMESTAMP, origin TIMESTAMP) RETURNS TIMESTAMP
77+
AS '@MODULE_PATHNAME@', 'ts_update_placeholder' LANGUAGE C IMMUTABLE PARALLEL SAFE STRICT;
78+
79+
CREATE OR REPLACE FUNCTION timescaledb_experimental.time_bucket_ng(bucket_width INTERVAL, ts TIMESTAMPTZ, timezone TEXT) RETURNS TIMESTAMPTZ
80+
AS '@MODULE_PATHNAME@', 'ts_update_placeholder' LANGUAGE C IMMUTABLE PARALLEL SAFE STRICT;
81+
82+
CREATE OR REPLACE FUNCTION timescaledb_experimental.time_bucket_ng(bucket_width INTERVAL, ts TIMESTAMPTZ, origin TIMESTAMPTZ, timezone TEXT) RETURNS TIMESTAMPTZ
83+
AS '@MODULE_PATHNAME@', 'ts_update_placeholder' LANGUAGE C IMMUTABLE PARALLEL SAFE STRICT;
84+
85+
CREATE OR REPLACE FUNCTION timescaledb_experimental.time_bucket_ng(bucket_width INTERVAL, ts TIMESTAMPTZ) RETURNS TIMESTAMPTZ
86+
AS '@MODULE_PATHNAME@', 'ts_update_placeholder' LANGUAGE C STABLE PARALLEL SAFE STRICT;
87+
88+
CREATE OR REPLACE FUNCTION timescaledb_experimental.time_bucket_ng(bucket_width INTERVAL, ts TIMESTAMPTZ, origin TIMESTAMPTZ) RETURNS TIMESTAMPTZ
89+
AS '@MODULE_PATHNAME@', 'ts_update_placeholder' LANGUAGE C STABLE PARALLEL SAFE STRICT;
90+
91+
-- Migrate a CAgg which is using the experimental time_bucket_ng function
92+
-- into a CAgg using the regular time_bucket function
93+
CREATE OR REPLACE PROCEDURE _timescaledb_functions.cagg_migrate_to_time_bucket(cagg REGCLASS)
94+
AS '@MODULE_PATHNAME@', 'ts_update_placeholder' LANGUAGE C;

src/cross_module_fn.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ CROSSMODULE_WRAPPER(continuous_agg_process_hypertable_invalidations);
9595
CROSSMODULE_WRAPPER(continuous_agg_validate_query);
9696
CROSSMODULE_WRAPPER(continuous_agg_get_bucket_function);
9797
CROSSMODULE_WRAPPER(continuous_agg_get_bucket_function_info);
98-
CROSSMODULE_WRAPPER(continuous_agg_migrate_to_time_bucket);
9998
CROSSMODULE_WRAPPER(cagg_try_repair);
10099

101100
CROSSMODULE_WRAPPER(chunk_freeze_chunk);
@@ -422,7 +421,6 @@ TSDLLEXPORT CrossModuleFunctions ts_cm_functions_default = {
422421
.continuous_agg_validate_query = error_no_default_fn_pg_community,
423422
.continuous_agg_get_bucket_function = error_no_default_fn_pg_community,
424423
.continuous_agg_get_bucket_function_info = error_no_default_fn_pg_community,
425-
.continuous_agg_migrate_to_time_bucket = error_no_default_fn_pg_community,
426424
.cagg_try_repair = process_cagg_try_repair,
427425

428426
/* compression */

src/cross_module_fn.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ typedef struct CrossModuleFunctions
121121
PGFunction continuous_agg_validate_query;
122122
PGFunction continuous_agg_get_bucket_function;
123123
PGFunction continuous_agg_get_bucket_function_info;
124-
PGFunction continuous_agg_migrate_to_time_bucket;
125124
PGFunction cagg_try_repair;
126125

127126
PGFunction compressed_data_send;

src/func_cache.c

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -363,66 +363,6 @@ static FuncInfo funcinfo[] = {
363363
.group_estimate = time_bucket_group_estimate,
364364
.sort_transform = time_bucket_tz_sort_transform,
365365
},
366-
{
367-
.origin = ORIGIN_TIMESCALE_EXPERIMENTAL,
368-
.is_bucketing_func = true,
369-
.allowed_in_cagg_definition = false,
370-
.funcname = "time_bucket_ng",
371-
.nargs = 2,
372-
.arg_types = { INTERVALOID, DATEOID },
373-
.group_estimate = time_bucket_group_estimate,
374-
.sort_transform = time_bucket_sort_transform,
375-
},
376-
{
377-
.origin = ORIGIN_TIMESCALE_EXPERIMENTAL,
378-
.is_bucketing_func = true,
379-
.allowed_in_cagg_definition = false,
380-
.funcname = "time_bucket_ng",
381-
.nargs = 3,
382-
.arg_types = { INTERVALOID, DATEOID, DATEOID },
383-
.group_estimate = time_bucket_group_estimate,
384-
.sort_transform = time_bucket_sort_transform,
385-
},
386-
{
387-
.origin = ORIGIN_TIMESCALE_EXPERIMENTAL,
388-
.is_bucketing_func = true,
389-
.allowed_in_cagg_definition = false,
390-
.funcname = "time_bucket_ng",
391-
.nargs = 2,
392-
.arg_types = { INTERVALOID, TIMESTAMPOID },
393-
.group_estimate = time_bucket_group_estimate,
394-
.sort_transform = time_bucket_sort_transform,
395-
},
396-
{
397-
.origin = ORIGIN_TIMESCALE_EXPERIMENTAL,
398-
.is_bucketing_func = true,
399-
.allowed_in_cagg_definition = false,
400-
.funcname = "time_bucket_ng",
401-
.nargs = 3,
402-
.arg_types = { INTERVALOID, TIMESTAMPOID, TIMESTAMPOID },
403-
.group_estimate = time_bucket_group_estimate,
404-
.sort_transform = time_bucket_sort_transform,
405-
},
406-
{
407-
.origin = ORIGIN_TIMESCALE_EXPERIMENTAL,
408-
.is_bucketing_func = true,
409-
.allowed_in_cagg_definition = false,
410-
.funcname = "time_bucket_ng",
411-
.nargs = 3,
412-
.arg_types = { INTERVALOID, TIMESTAMPTZOID, TEXTOID },
413-
.group_estimate = time_bucket_group_estimate,
414-
.sort_transform = time_bucket_sort_transform,
415-
},
416-
{
417-
.origin = ORIGIN_TIMESCALE_EXPERIMENTAL,
418-
.is_bucketing_func = true,
419-
.allowed_in_cagg_definition = false,
420-
.funcname = "time_bucket_ng",
421-
.nargs = 4,
422-
.arg_types = { INTERVALOID, TIMESTAMPTZOID, TIMESTAMPTZOID, TEXTOID },
423-
.group_estimate = time_bucket_group_estimate,
424-
.sort_transform = time_bucket_sort_transform,
425-
},
426366
{
427367
.origin = ORIGIN_TIMESCALE,
428368
.is_bucketing_func = true,

src/guc.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,6 @@ char *ts_last_tune_version = NULL;
213213

214214
bool ts_guc_debug_require_batch_sorted_merge = false;
215215

216-
bool ts_guc_debug_allow_cagg_with_deprecated_funcs = false;
217-
218216
/*
219217
* Exit code for the scheduler.
220218
*
@@ -1425,16 +1423,6 @@ _guc_init(void)
14251423
/* assign_hook= */ NULL,
14261424
/* show_hook= */ NULL);
14271425

1428-
DefineCustomBoolVariable(/* name= */ MAKE_EXTOPTION("debug_allow_cagg_with_deprecated_funcs"),
1429-
/* short_desc= */ "allow new caggs using time_bucket_ng",
1430-
/* long_desc= */ "this is for debugging/testing purposes",
1431-
/* valueAddr= */ &ts_guc_debug_allow_cagg_with_deprecated_funcs,
1432-
/* bootValue= */ false,
1433-
/* context= */ PGC_USERSET,
1434-
/* flags= */ 0,
1435-
/* check_hook= */ NULL,
1436-
/* assign_hook= */ NULL,
1437-
/* show_hook= */ NULL);
14381426
#endif
14391427

14401428
DefineCustomBoolVariable(MAKE_EXTOPTION("default_hypercore_use_access_method"),

0 commit comments

Comments
 (0)