Skip to content

[Rewrites] Omnisharded inserts with timestamps should use proxy time #1521

Description

@levkk

For inserts targeting omnisharded columns, we should intercept and rewrite calls to now() (and other timestamp-related functions) and replace them with a value we generate. This makes sure the value is the same on all shards.

Example

INSERT INTO omni (name, created_at) VALUES ('test', now());
INSERT INTO omni (name, created_at) VALUES ('test', '2026-09-10T10:00:01.342Z');

Make sure to handle this for TIMESTAMPTZ (UTC) and TIMESTAMP; the latter needs to fetch the database timezone and use that.

Additionally, for queries that don't specify now() and rely on a database default, we should inject our timestamp, just like we do for primary keys (auto_id).

Activity

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

Metadata

Metadata

Assignees

Labels

acceptedThe issue is added to our backlog.

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions