fix(database): read live instants at UTC, so Neon Realtime accepts the statements
After #3217 merged, the desktop's Inbox tab came up empty in production. Neon Realtime rejected all seven of the account inbox's live statements. Its proxy logged, for each one:
neon_realtime_query_rejected … unsupported query: scalar expression uses a mutable function
Each statement turns timestamps into epoch milliseconds with extract(epoch from <timestamptz>). In Postgres that function is only STABLE, because it reads the session's time zone (provolatile = 's' on production), and Realtime only accepts IMMUTABLE functions.
Fix: live-statement.ts's epochMillis now converts to UTC first, as extract(epoch from (col at time zone 'UTC')). Both timezone(text, timestamptz) and extract(text, timestamp) are IMMUTABLE, and the epoch comes out the same: on production's 480 inbox items, none differ. liveLatest now goes through the same helper. Every live statement builds its timestamps through these two helpers, so the later Realtime PRs get the fix too.
No behaviour changes for held reads.
Made with Luke