Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), version

## [Unreleased]

## [0.1.3] - 2026-06-09

### Fixed

- **Timezone-stable chunk names.** `_ensure_partitions` rendered `chunk_name` with `to_char(range_start, …)` in the **session timezone**, while `range_start` is an absolute `timestamptz`. Running the partition manager under different session timezones (e.g. a job in UTC vs a client in UTC+2) produced names that no longer matched `range_start`, so the partition manager hit `duplicate key value violates unique constraint "idx_chunk_metadata_chunk_name"` (the `ON CONFLICT (chronotable_id, range_start)` couldn't absorb a `chunk_name` collision). Names are now rendered from the instant in UTC (`v_start AT TIME ZONE 'UTC'`), keeping `chunk_name` 1:1 with `range_start` regardless of session timezone.

Upgrade by reinstalling `dist/lakets.sql`. Any chunk rows created before this fix under a non-UTC session keep their old names; if the partition manager still collides, drop the stale rows for already-dropped chunks (their partitions are gone) and let it recreate them.

## [0.1.2] - 2026-06-08

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.2
0.1.3
2 changes: 1 addition & 1 deletion sql/00_version.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ SET client_min_messages TO NOTICE;
DO $$
DECLARE
v_installed TEXT;
v_incoming TEXT := coalesce(nullif('__LAKETS_VERSION__', '__LAKE' || 'TS_VERSION__'), '0.1.2');
v_incoming TEXT := coalesce(nullif('__LAKETS_VERSION__', '__LAKE' || 'TS_VERSION__'), '0.1.3');
v_installed_parts INT[];
v_incoming_parts INT[];
BEGIN
Expand Down
9 changes: 7 additions & 2 deletions sql/02_chronotable.sql
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,21 @@ BEGIN
AND status != 'dropped'
) THEN
BEGIN
-- Render the chunk name from the absolute instant in UTC. range_start
-- is a timestamptz, so to_char in the session timezone would name the
-- same chunk differently across sessions (e.g. a job in UTC vs a client
-- in UTC+2), desyncing chunk_name from range_start and colliding on the
-- chunk_name unique index. UTC keeps the name 1:1 with range_start.
EXECUTE format(
'CREATE TABLE IF NOT EXISTS %I.%I PARTITION OF %I.%I FOR VALUES FROM (%L) TO (%L)',
v_schema,
v_table || '_' || to_char(v_start, 'YYYYMMDD_HH24MISS'),
v_table || '_' || to_char(v_start AT TIME ZONE 'UTC', 'YYYYMMDD_HH24MISS'),
v_schema, v_table, v_start, v_end
);
INSERT INTO lakets._chunk_metadata
(chronotable_id, chunk_name, range_start, range_end, status)
VALUES (p_chronotable_id,
v_schema || '.' || v_table || '_' || to_char(v_start, 'YYYYMMDD_HH24MISS'),
v_schema || '.' || v_table || '_' || to_char(v_start AT TIME ZONE 'UTC', 'YYYYMMDD_HH24MISS'),
v_start, v_end, 'active')
ON CONFLICT (chronotable_id, range_start) DO NOTHING;
v_partitions_created := v_partitions_created + 1;
Expand Down