Skip to content

Commit 56f53be

Browse files
committed
Version 5
1 parent 4e6979d commit 56f53be

File tree

9 files changed

+40
-42
lines changed

9 files changed

+40
-42
lines changed

tsl/src/continuous_aggs/common.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1497,7 +1497,6 @@ tsl_cagg_get_bucket_function_info(Oid view_oid)
14971497
Assert(query->commandType == CMD_SELECT);
14981498

14991499
ContinuousAggsBucketFunction *bf = palloc0(sizeof(ContinuousAggsBucketFunction));
1500-
TIMESTAMP_NOBEGIN(bf->bucket_time_origin);
15011500

15021501
ListCell *l;
15031502
foreach (l, query->groupClause)

tsl/src/continuous_aggs/utils.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,23 +596,22 @@ continuous_agg_migrate_to_time_bucket(PG_FUNCTION_ARGS)
596596
/* Update the time_bucket_fuction */
597597
cagg->bucket_function->bucket_function = new_bucket_function;
598598
bool origin_added_during_migration = false;
599-
TimestampTz bucket_time_origin_to_replace = cagg->bucket_function->bucket_time_origin;
600599

601600
/* Set new origin if not already present in the function definition. This is needed since
602601
* time_bucket and time_bucket_ng use different origin default values.
603602
*/
604603
if (cagg->bucket_function->bucket_time_based &&
605604
TIMESTAMP_NOT_FINITE(cagg->bucket_function->bucket_time_origin))
606605
{
607-
bucket_time_origin_to_replace = continuous_agg_get_default_origin(new_bucket_function);
606+
cagg->bucket_function->bucket_time_origin = continuous_agg_get_default_origin(new_bucket_function);;
608607
origin_added_during_migration = true;
609608
}
610609

611610
/* Modify the CAgg view definition */
612611
continuous_agg_replace_function(cagg,
613612
old_bucket_function,
614613
origin_added_during_migration,
615-
bucket_time_origin_to_replace,
614+
cagg->bucket_function->bucket_time_origin,
616615
need_parameter_order_change);
617616

618617
CommandCounterIncrement();

tsl/test/expected/cagg_query-14.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,7 @@ psql:include/cagg_query_common.sql:484: NOTICE: refreshing continuous aggregate
10421042
SELECT * FROM caggs_info WHERE user_view_name = 'cagg_4_hours_date_origin';
10431043
user_view_schema | user_view_name | bucket_func | bucket_width | bucket_origin | bucket_offset | bucket_timezone | bucket_fixed_width
10441044
------------------+--------------------------+---------------------------------+--------------+------------------------------+---------------+-----------------+--------------------
1045-
public | cagg_4_hours_date_origin | time_bucket(interval,date,date) | @ 4 days | Fri Dec 31 16:00:00 1999 PST | | | t
1045+
public | cagg_4_hours_date_origin | time_bucket(interval,date,date) | @ 4 days | Sat Jan 01 00:00:00 2000 PST | | | t
10461046
(1 row)
10471047

10481048
DROP MATERIALIZED VIEW cagg_4_hours_date_origin;
@@ -1056,7 +1056,7 @@ psql:include/cagg_query_common.sql:492: NOTICE: refreshing continuous aggregate
10561056
SELECT * FROM caggs_info WHERE user_view_name = 'cagg_4_hours_date_origin2';
10571057
user_view_schema | user_view_name | bucket_func | bucket_width | bucket_origin | bucket_offset | bucket_timezone | bucket_fixed_width
10581058
------------------+---------------------------+---------------------------------+--------------+------------------------------+---------------+-----------------+--------------------
1059-
public | cagg_4_hours_date_origin2 | time_bucket(interval,date,date) | @ 4 days | Fri Dec 31 16:00:00 1999 PST | | | t
1059+
public | cagg_4_hours_date_origin2 | time_bucket(interval,date,date) | @ 4 days | Sat Jan 01 00:00:00 2000 PST | | | t
10601060
(1 row)
10611061

10621062
DROP MATERIALIZED VIEW cagg_4_hours_date_origin2;

tsl/test/expected/cagg_query-15.out

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,9 +1040,9 @@ CREATE MATERIALIZED VIEW cagg_4_hours_date_origin
10401040
GROUP BY 1 ORDER BY 1;
10411041
psql:include/cagg_query_common.sql:484: NOTICE: refreshing continuous aggregate "cagg_4_hours_date_origin"
10421042
SELECT * FROM caggs_info WHERE user_view_name = 'cagg_4_hours_date_origin';
1043-
user_view_schema | user_view_name | bucket_func | bucket_width | bucket_origin | bucket_offset | bucket_timezone | bucket_fixed_width
1044-
------------------+--------------------------+--------------------------------------------------------------+--------------+------------------------------+---------------+-----------------+--------------------
1045-
public | cagg_4_hours_date_origin | public.time_bucket(interval,pg_catalog.date,pg_catalog.date) | @ 4 days | Sat Jan 01 00:00:00 2000 PST | | | t
1043+
user_view_schema | user_view_name | bucket_func | bucket_width | bucket_origin | bucket_offset | bucket_timezone | bucket_fixed_width
1044+
------------------+--------------------------+---------------------------------+--------------+------------------------------+---------------+-----------------+--------------------
1045+
public | cagg_4_hours_date_origin | time_bucket(interval,date,date) | @ 4 days | Sat Jan 01 00:00:00 2000 PST | | | t
10461046
(1 row)
10471047

10481048
DROP MATERIALIZED VIEW cagg_4_hours_date_origin;
@@ -1054,9 +1054,9 @@ CREATE MATERIALIZED VIEW cagg_4_hours_date_origin2
10541054
GROUP BY 1 ORDER BY 1;
10551055
psql:include/cagg_query_common.sql:492: NOTICE: refreshing continuous aggregate "cagg_4_hours_date_origin2"
10561056
SELECT * FROM caggs_info WHERE user_view_name = 'cagg_4_hours_date_origin2';
1057-
user_view_schema | user_view_name | bucket_func | bucket_width | bucket_origin | bucket_offset | bucket_timezone | bucket_fixed_width
1058-
------------------+---------------------------+--------------------------------------------------------------+--------------+------------------------------+---------------+-----------------+--------------------
1059-
public | cagg_4_hours_date_origin2 | public.time_bucket(interval,pg_catalog.date,pg_catalog.date) | @ 4 days | Sat Jan 01 00:00:00 2000 PST | | | t
1057+
user_view_schema | user_view_name | bucket_func | bucket_width | bucket_origin | bucket_offset | bucket_timezone | bucket_fixed_width
1058+
------------------+---------------------------+---------------------------------+--------------+------------------------------+---------------+-----------------+--------------------
1059+
public | cagg_4_hours_date_origin2 | time_bucket(interval,date,date) | @ 4 days | Sat Jan 01 00:00:00 2000 PST | | | t
10601060
(1 row)
10611061

10621062
DROP MATERIALIZED VIEW cagg_4_hours_date_origin2;

tsl/test/expected/cagg_query-16.out

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,9 +1034,9 @@ CREATE MATERIALIZED VIEW cagg_4_hours_date_origin
10341034
GROUP BY 1 ORDER BY 1;
10351035
psql:include/cagg_query_common.sql:484: NOTICE: refreshing continuous aggregate "cagg_4_hours_date_origin"
10361036
SELECT * FROM caggs_info WHERE user_view_name = 'cagg_4_hours_date_origin';
1037-
user_view_schema | user_view_name | bucket_func | bucket_width | bucket_origin | bucket_offset | bucket_timezone | bucket_fixed_width
1038-
------------------+--------------------------+--------------------------------------------------------------+--------------+------------------------------+---------------+-----------------+--------------------
1039-
public | cagg_4_hours_date_origin | public.time_bucket(interval,pg_catalog.date,pg_catalog.date) | @ 4 days | Sat Jan 01 00:00:00 2000 PST | | | t
1037+
user_view_schema | user_view_name | bucket_func | bucket_width | bucket_origin | bucket_offset | bucket_timezone | bucket_fixed_width
1038+
------------------+--------------------------+---------------------------------+--------------+------------------------------+---------------+-----------------+--------------------
1039+
public | cagg_4_hours_date_origin | time_bucket(interval,date,date) | @ 4 days | Sat Jan 01 00:00:00 2000 PST | | | t
10401040
(1 row)
10411041

10421042
DROP MATERIALIZED VIEW cagg_4_hours_date_origin;
@@ -1048,9 +1048,9 @@ CREATE MATERIALIZED VIEW cagg_4_hours_date_origin2
10481048
GROUP BY 1 ORDER BY 1;
10491049
psql:include/cagg_query_common.sql:492: NOTICE: refreshing continuous aggregate "cagg_4_hours_date_origin2"
10501050
SELECT * FROM caggs_info WHERE user_view_name = 'cagg_4_hours_date_origin2';
1051-
user_view_schema | user_view_name | bucket_func | bucket_width | bucket_origin | bucket_offset | bucket_timezone | bucket_fixed_width
1052-
------------------+---------------------------+--------------------------------------------------------------+--------------+------------------------------+---------------+-----------------+--------------------
1053-
public | cagg_4_hours_date_origin2 | public.time_bucket(interval,pg_catalog.date,pg_catalog.date) | @ 4 days | Sat Jan 01 00:00:00 2000 PST | | | t
1051+
user_view_schema | user_view_name | bucket_func | bucket_width | bucket_origin | bucket_offset | bucket_timezone | bucket_fixed_width
1052+
------------------+---------------------------+---------------------------------+--------------+------------------------------+---------------+-----------------+--------------------
1053+
public | cagg_4_hours_date_origin2 | time_bucket(interval,date,date) | @ 4 days | Sat Jan 01 00:00:00 2000 PST | | | t
10541054
(1 row)
10551055

10561056
DROP MATERIALIZED VIEW cagg_4_hours_date_origin2;

tsl/test/expected/cagg_query-17.out

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,9 +1034,9 @@ CREATE MATERIALIZED VIEW cagg_4_hours_date_origin
10341034
GROUP BY 1 ORDER BY 1;
10351035
psql:include/cagg_query_common.sql:484: NOTICE: refreshing continuous aggregate "cagg_4_hours_date_origin"
10361036
SELECT * FROM caggs_info WHERE user_view_name = 'cagg_4_hours_date_origin';
1037-
user_view_schema | user_view_name | bucket_func | bucket_width | bucket_origin | bucket_offset | bucket_timezone | bucket_fixed_width
1038-
------------------+--------------------------+--------------------------------------------------------------+--------------+------------------------------+---------------+-----------------+--------------------
1039-
public | cagg_4_hours_date_origin | public.time_bucket(interval,pg_catalog.date,pg_catalog.date) | @ 4 days | Sat Jan 01 00:00:00 2000 PST | | | t
1037+
user_view_schema | user_view_name | bucket_func | bucket_width | bucket_origin | bucket_offset | bucket_timezone | bucket_fixed_width
1038+
------------------+--------------------------+---------------------------------+--------------+------------------------------+---------------+-----------------+--------------------
1039+
public | cagg_4_hours_date_origin | time_bucket(interval,date,date) | @ 4 days | Sat Jan 01 00:00:00 2000 PST | | | t
10401040
(1 row)
10411041

10421042
DROP MATERIALIZED VIEW cagg_4_hours_date_origin;
@@ -1048,9 +1048,9 @@ CREATE MATERIALIZED VIEW cagg_4_hours_date_origin2
10481048
GROUP BY 1 ORDER BY 1;
10491049
psql:include/cagg_query_common.sql:492: NOTICE: refreshing continuous aggregate "cagg_4_hours_date_origin2"
10501050
SELECT * FROM caggs_info WHERE user_view_name = 'cagg_4_hours_date_origin2';
1051-
user_view_schema | user_view_name | bucket_func | bucket_width | bucket_origin | bucket_offset | bucket_timezone | bucket_fixed_width
1052-
------------------+---------------------------+--------------------------------------------------------------+--------------+------------------------------+---------------+-----------------+--------------------
1053-
public | cagg_4_hours_date_origin2 | public.time_bucket(interval,pg_catalog.date,pg_catalog.date) | @ 4 days | Sat Jan 01 00:00:00 2000 PST | | | t
1051+
user_view_schema | user_view_name | bucket_func | bucket_width | bucket_origin | bucket_offset | bucket_timezone | bucket_fixed_width
1052+
------------------+---------------------------+---------------------------------+--------------+------------------------------+---------------+-----------------+--------------------
1053+
public | cagg_4_hours_date_origin2 | time_bucket(interval,date,date) | @ 4 days | Sat Jan 01 00:00:00 2000 PST | | | t
10541054
(1 row)
10551055

10561056
DROP MATERIALIZED VIEW cagg_4_hours_date_origin2;

tsl/test/expected/cagg_query_using_merge-15.out

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,9 +1042,9 @@ CREATE MATERIALIZED VIEW cagg_4_hours_date_origin
10421042
GROUP BY 1 ORDER BY 1;
10431043
psql:include/cagg_query_common.sql:484: NOTICE: refreshing continuous aggregate "cagg_4_hours_date_origin"
10441044
SELECT * FROM caggs_info WHERE user_view_name = 'cagg_4_hours_date_origin';
1045-
user_view_schema | user_view_name | bucket_func | bucket_width | bucket_origin | bucket_offset | bucket_timezone | bucket_fixed_width
1046-
------------------+--------------------------+--------------------------------------------------------------+--------------+------------------------------+---------------+-----------------+--------------------
1047-
public | cagg_4_hours_date_origin | public.time_bucket(interval,pg_catalog.date,pg_catalog.date) | @ 4 days | Sat Jan 01 00:00:00 2000 PST | | | t
1045+
user_view_schema | user_view_name | bucket_func | bucket_width | bucket_origin | bucket_offset | bucket_timezone | bucket_fixed_width
1046+
------------------+--------------------------+---------------------------------+--------------+------------------------------+---------------+-----------------+--------------------
1047+
public | cagg_4_hours_date_origin | time_bucket(interval,date,date) | @ 4 days | Sat Jan 01 00:00:00 2000 PST | | | t
10481048
(1 row)
10491049

10501050
DROP MATERIALIZED VIEW cagg_4_hours_date_origin;
@@ -1056,9 +1056,9 @@ CREATE MATERIALIZED VIEW cagg_4_hours_date_origin2
10561056
GROUP BY 1 ORDER BY 1;
10571057
psql:include/cagg_query_common.sql:492: NOTICE: refreshing continuous aggregate "cagg_4_hours_date_origin2"
10581058
SELECT * FROM caggs_info WHERE user_view_name = 'cagg_4_hours_date_origin2';
1059-
user_view_schema | user_view_name | bucket_func | bucket_width | bucket_origin | bucket_offset | bucket_timezone | bucket_fixed_width
1060-
------------------+---------------------------+--------------------------------------------------------------+--------------+------------------------------+---------------+-----------------+--------------------
1061-
public | cagg_4_hours_date_origin2 | public.time_bucket(interval,pg_catalog.date,pg_catalog.date) | @ 4 days | Sat Jan 01 00:00:00 2000 PST | | | t
1059+
user_view_schema | user_view_name | bucket_func | bucket_width | bucket_origin | bucket_offset | bucket_timezone | bucket_fixed_width
1060+
------------------+---------------------------+---------------------------------+--------------+------------------------------+---------------+-----------------+--------------------
1061+
public | cagg_4_hours_date_origin2 | time_bucket(interval,date,date) | @ 4 days | Sat Jan 01 00:00:00 2000 PST | | | t
10621062
(1 row)
10631063

10641064
DROP MATERIALIZED VIEW cagg_4_hours_date_origin2;

tsl/test/expected/cagg_query_using_merge-16.out

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,9 +1036,9 @@ CREATE MATERIALIZED VIEW cagg_4_hours_date_origin
10361036
GROUP BY 1 ORDER BY 1;
10371037
psql:include/cagg_query_common.sql:484: NOTICE: refreshing continuous aggregate "cagg_4_hours_date_origin"
10381038
SELECT * FROM caggs_info WHERE user_view_name = 'cagg_4_hours_date_origin';
1039-
user_view_schema | user_view_name | bucket_func | bucket_width | bucket_origin | bucket_offset | bucket_timezone | bucket_fixed_width
1040-
------------------+--------------------------+--------------------------------------------------------------+--------------+------------------------------+---------------+-----------------+--------------------
1041-
public | cagg_4_hours_date_origin | public.time_bucket(interval,pg_catalog.date,pg_catalog.date) | @ 4 days | Sat Jan 01 00:00:00 2000 PST | | | t
1039+
user_view_schema | user_view_name | bucket_func | bucket_width | bucket_origin | bucket_offset | bucket_timezone | bucket_fixed_width
1040+
------------------+--------------------------+---------------------------------+--------------+------------------------------+---------------+-----------------+--------------------
1041+
public | cagg_4_hours_date_origin | time_bucket(interval,date,date) | @ 4 days | Sat Jan 01 00:00:00 2000 PST | | | t
10421042
(1 row)
10431043

10441044
DROP MATERIALIZED VIEW cagg_4_hours_date_origin;
@@ -1050,9 +1050,9 @@ CREATE MATERIALIZED VIEW cagg_4_hours_date_origin2
10501050
GROUP BY 1 ORDER BY 1;
10511051
psql:include/cagg_query_common.sql:492: NOTICE: refreshing continuous aggregate "cagg_4_hours_date_origin2"
10521052
SELECT * FROM caggs_info WHERE user_view_name = 'cagg_4_hours_date_origin2';
1053-
user_view_schema | user_view_name | bucket_func | bucket_width | bucket_origin | bucket_offset | bucket_timezone | bucket_fixed_width
1054-
------------------+---------------------------+--------------------------------------------------------------+--------------+------------------------------+---------------+-----------------+--------------------
1055-
public | cagg_4_hours_date_origin2 | public.time_bucket(interval,pg_catalog.date,pg_catalog.date) | @ 4 days | Sat Jan 01 00:00:00 2000 PST | | | t
1053+
user_view_schema | user_view_name | bucket_func | bucket_width | bucket_origin | bucket_offset | bucket_timezone | bucket_fixed_width
1054+
------------------+---------------------------+---------------------------------+--------------+------------------------------+---------------+-----------------+--------------------
1055+
public | cagg_4_hours_date_origin2 | time_bucket(interval,date,date) | @ 4 days | Sat Jan 01 00:00:00 2000 PST | | | t
10561056
(1 row)
10571057

10581058
DROP MATERIALIZED VIEW cagg_4_hours_date_origin2;

0 commit comments

Comments
 (0)