Skip to content

fix: store realtime.messages timestamps in UTC - #2365

Open
mandar1045 wants to merge 1 commit into
supabase:mainfrom
mandar1045:fix/messages-utc-timestamps
Open

mandar1045 wants to merge 1 commit into
supabase:mainfrom
mandar1045:fix/messages-utc-timestamps

Conversation

@mandar1045

Copy link
Copy Markdown
Contributor

Fixes #2364

inserted_at and updated_at defaulted to now(), which turns into the session's local time when cast to timestamp. Replay and everything else reads them as UTC, so messages sent from a non-UTC session were replayed from the wrong window or not at all.

This switches both defaults to timezone('utc', now()), same as realtime.subscription.created_at. That covers realtime.send, send_binary and direct inserts without touching the functions.

  • New migration for the two defaults
  • Regenerated tenant_schema and the pg15/pg17 dumps
  • Added a replay test that sends from an Asia/Kolkata session

Walrus suite passes on 15 and 17, from both the dumps and the migrations.

@mandar1045
mandar1045 force-pushed the fix/messages-utc-timestamps branch from 9e4fd6f to 7df1b32 Compare October 8, 2026 02:15
inserted_at and updated_at defaulted to now(), which becomes the session's
local time when cast to timestamp. Replay reads them as UTC, so messages
sent from a non-UTC session were replayed from the wrong window or not at
all.

Default both to timezone('utc', now()), like
realtime.subscription.created_at.

Fixes supabase#2364
@mandar1045
mandar1045 force-pushed the fix/messages-utc-timestamps branch from 7df1b32 to 18efff3 Compare October 8, 2026 06:45

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Broadcast replay misses messages when the database timezone isn't UTC

1 participant