Skip to content

Commit

Permalink
Fixed const handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jnidzwetzki committed Dec 13, 2023
1 parent e7db6b4 commit 36c7b22
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions .unreleased/feature_6382
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Implements: #6382 Support for time_bucket with origin and offset in CAggs
7 changes: 5 additions & 2 deletions tsl/src/continuous_aggs/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,11 @@ caggtimebucket_validate(CAggTimebucketInfo *tbinfo, List *groupClause, List *tar
if (list_length(fe->args) >= 3 && exprType(lthird(fe->args)) == TIMESTAMPTZOID)
{
custom_origin = true;
tbinfo->origin =
DatumGetTimestampTz(castNode(Const, lthird(fe->args))->constvalue);
if (IsA(lthird(fe->args), Const))
{
tbinfo->origin =
DatumGetTimestampTz(castNode(Const, lthird(fe->args))->constvalue);
}
}
else if (list_length(fe->args) >= 4 &&
exprType(lfourth(fe->args)) == TIMESTAMPTZOID)
Expand Down
2 changes: 1 addition & 1 deletion tsl/test/expected/cagg_watermark.out
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ NOTICE: adding not-null constraint to column "time"
(2,public,continuous_agg_test_mat,t)
(1 row)

INSERT INTO _timescaledb_catalog.continuous_agg VALUES (2, 1, NULL, '','','','',0,'','');
INSERT INTO _timescaledb_catalog.continuous_agg VALUES (2, 1, NULL, '', '', '', '', 0, NULL, NULL, '', '');
\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER
-- create the trigger
CREATE TRIGGER continuous_agg_insert_trigger
Expand Down
2 changes: 1 addition & 1 deletion tsl/test/sql/cagg_watermark.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log;
\c :TEST_DBNAME :ROLE_SUPERUSER
CREATE TABLE continuous_agg_test_mat(time int);
select create_hypertable('continuous_agg_test_mat', 'time', chunk_time_interval=> 10);
INSERT INTO _timescaledb_catalog.continuous_agg VALUES (2, 1, NULL, '','','','',0,'','');
INSERT INTO _timescaledb_catalog.continuous_agg VALUES (2, 1, NULL, '', '', '', '', 0, NULL, NULL, '', '');
\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER

-- create the trigger
Expand Down

0 comments on commit 36c7b22

Please sign in to comment.