Skip to content

Commit ee96cfd

Browse files
committed
Show chunks view range as timestamps for UUIDv7
When using the chunks view, it makes sense to show the time range as timestamp for UUIDv7-partitioned tables. Previously, the range was a unix timestamp integer.
1 parent 498bcf2 commit ee96cfd

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

.unreleased/pr_8786

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Implements: #8786 Display chunks view range as timestamps for UUIDv7

sql/updates/latest-dev.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
21
DROP FUNCTION IF EXISTS _timescaledb_functions.policy_job_stat_history_retention;
2+
DROP VIEW IF EXISTS timescaledb_information.chunks;
33

sql/updates/reverse-dev.sql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
21
DROP FUNCTION IF EXISTS _timescaledb_functions.policy_job_stat_history_retention;
3-
2+
DROP VIEW IF EXISTS timescaledb_information.chunks;

sql/views.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,22 +178,22 @@ FROM (
178178
dim.column_name AS primary_dimension,
179179
dim.column_type AS primary_dimension_type,
180180
row_number() OVER (PARTITION BY chcons.chunk_id ORDER BY dim.id) AS chunk_dimension_num,
181-
CASE WHEN dim.column_type = ANY(ARRAY['timestamp','timestamptz','date']::regtype[]) THEN
181+
CASE WHEN dim.column_type = ANY(ARRAY['timestamp','timestamptz','date', 'uuid']::regtype[]) THEN
182182
_timescaledb_functions.to_timestamp(dimsl.range_start)
183183
ELSE
184184
NULL
185185
END AS range_start,
186-
CASE WHEN dim.column_type = ANY(ARRAY['timestamp','timestamptz','date']::regtype[]) THEN
186+
CASE WHEN dim.column_type = ANY(ARRAY['timestamp','timestamptz','date', 'uuid']::regtype[]) THEN
187187
_timescaledb_functions.to_timestamp(dimsl.range_end)
188188
ELSE
189189
NULL
190190
END AS range_end,
191-
CASE WHEN dim.column_type = ANY(ARRAY['timestamp','timestamptz','date']::regtype[]) THEN
191+
CASE WHEN dim.column_type = ANY(ARRAY['timestamp','timestamptz','date', 'uuid']::regtype[]) THEN
192192
NULL
193193
ELSE
194194
dimsl.range_start
195195
END AS integer_range_start,
196-
CASE WHEN dim.column_type = ANY(ARRAY['timestamp','timestamptz','date']::regtype[]) THEN
196+
CASE WHEN dim.column_type = ANY(ARRAY['timestamp','timestamptz','date', 'uuid']::regtype[]) THEN
197197
NULL
198198
ELSE
199199
dimsl.range_end

test/expected/uuid.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ ORDER BY id DESC;
239239
CREATE VIEW chunk_ranges AS
240240
SELECT
241241
chunk_name,
242-
_timescaledb_functions.to_timestamp(range_start_integer) AS range_start,
243-
_timescaledb_functions.to_timestamp(range_end_integer) AS range_end
242+
range_start,
243+
range_end
244244
FROM timescaledb_information.chunks
245245
WHERE hypertable_name = 'uuid_events';
246246
SELECT * FROM chunk_ranges;

test/sql/uuid.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ ORDER BY id DESC;
141141
CREATE VIEW chunk_ranges AS
142142
SELECT
143143
chunk_name,
144-
_timescaledb_functions.to_timestamp(range_start_integer) AS range_start,
145-
_timescaledb_functions.to_timestamp(range_end_integer) AS range_end
144+
range_start,
145+
range_end
146146
FROM timescaledb_information.chunks
147147
WHERE hypertable_name = 'uuid_events';
148148

0 commit comments

Comments
 (0)