You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The numeric format changed between PG13 and PG14 to include infinities.
As a result the serialized partial state of numeric aggregates also
changed format.
If a user that has stored partials (e.g. by using Continuous
Aggregates) upgrades to PG14 then the partial state deserialization
will lead to errors due to the mismatch with the PG14 code.
Repair the deserialization process on the fly by appending zeroed
plus-infinity and minus-infinity counts for the numeric aggregate state
to use.
Fixes#4427
SELECT a, b, _timescaledb_internal.partialize_agg( sum(b)) , _timescaledb_internal.partialize_agg( min(c)) , _timescaledb_internal.partialize_agg(max(d)) from foo group by a, b ;
164
+
SELECT a, b, _timescaledb_internal.partialize_agg(sum(b))
165
+
, _timescaledb_internal.partialize_agg(min(c))
166
+
, _timescaledb_internal.partialize_agg(max(d))
167
+
, _timescaledb_internal.partialize_agg(stddev(b))
168
+
, _timescaledb_internal.partialize_agg(stddev(e)) from foo group by a, b ;
, _timescaledb_internal.finalize_agg( 'max(timestamp with time zone)', null, null, null, partiald, null::timestamptz ) maxd from t1 group by a order by a ;
12 | 10 | hello | Sat Jan 02 06:00:00 2010 PST | |
181
191
(5 rows)
182
192
193
+
CREATE TABLE vfinal_res AS SELECT * FROM vfinal;
194
+
-- overwrite partials with dumped binary values from PostrgeSQL 13 --
195
+
TRUNCATE TABLE t1;
196
+
\COPY t1 FROM data/partialize_finalize_data.csv WITH CSV HEADER
197
+
--repeat query to verify partial serialization sanitization works for versions PG >= 14
198
+
CREATE TABLE vfinal_dump_res AS SELECT * FROM vfinal;
199
+
-- compare results to verify there is no difference
200
+
(SELECT * FROM vfinal_res) EXCEPT (SELECT * FROM vfinal_dump_res);
201
+
a | sumb | minc | maxd | stddevb | stddeve
202
+
---+------+------+------+---------+---------
203
+
(0 rows)
204
+
183
205
--with having clause --
184
206
select a, b , _timescaledb_internal.finalize_agg( 'min(text)', 'pg_catalog', 'default', null, partialc, null::text ) minc, _timescaledb_internal.finalize_agg( 'max(timestamp with time zone)', null, null, null, partiald, null::timestamptz ) maxd from t1 where b is not null group by a, b having _timescaledb_internal.finalize_agg( 'max(timestamp with time zone)', null, null, null, partiald, null::timestamptz ) is not null order by a, b;
185
207
a | b | minc | maxd
@@ -195,6 +217,7 @@ select a, b , _timescaledb_internal.finalize_agg( 'min(text)', 'pg_catalog', 'd
0 commit comments