timescale / timescaledb-toolkit

Extension for more hyperfunctions, fully compatible with TimescaleDB and PostgreSQL 📈
https://www.timescale.com
Other
385 stars 47 forks source link

Bugfix: make space saving aggregate serialization strict #815

Open vanderhoop opened 1 month ago

vanderhoop commented 1 month ago

This pull request follows in the footsteps of https://github.com/timescale/timescaledb-toolkit/pull/351 in making space saving aggregate serialization strict for frequency aggregates.

Motivation: I'm running into the following error when trying to refresh a continuous aggregate manually.

ERROR:  XX000: called `Option::unwrap()` on a `None` value
CONTEXT:  SQL statement “INSERT INTO _timescaledb_internal._materialized_hypertable_86 SELECT * FROM _timescaledb_internal._partial_view_86 AS I WHERE I.bucket >= $1 AND I.bucket < $2 ;”
LOCATION:  frequency.rs:961

This appears to be a known problem when the source table has empty partitions, and I would guess that there are other aggregates that still need to be made strict for serialization.