feat: re-write date/time functions (calls + DEFAULT) in omni inserts - #1541
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
levkk
reviewed
Sep 15, 2026
levkk
reviewed
Sep 15, 2026
levkk
reviewed
Sep 15, 2026
levkk
reviewed
Sep 15, 2026
levkk
reviewed
Sep 15, 2026
levkk
reviewed
Sep 15, 2026
levkk
reviewed
Sep 15, 2026
levkk
reviewed
Sep 15, 2026
levkk
reviewed
Sep 15, 2026
levkk
reviewed
Sep 15, 2026
levkk
reviewed
Sep 15, 2026
levkk
reviewed
Sep 15, 2026
levkk
reviewed
Sep 15, 2026
levkk
reviewed
Sep 15, 2026
levkk
reviewed
Sep 15, 2026
levkk
reviewed
Sep 15, 2026
jkaczman
marked this pull request as ready for review
September 15, 2026 23:17
jkaczman
force-pushed
the
jk-use-proxy-time
branch
from
September 15, 2026 23:49
7ce7107 to
53b6807
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

When we perform an
INSERTinto an omnisharded table, right now, the functions within the statement (orCOLUMN_DEFAULTin the table schema) are executed separately on each shard. In the case of time/date functions, this means that they will drift slightly apart, as their execution time will not be the exact same.To fix this, this PR re-writes all those time/date functions (Postgres ref), specifically:
current_date,current_time,current_timestamp,clock_timestamp,localtime,localtimestamp,now,statement_timestamp,timeofday, andtransaction_timestamp.It handles both calls within a
VALUESlist, as well as is compatible with functions specified withinCOLUMN_DEFAULTin the table schema. It's also compatible with simple protocol, extended protocol, and prepare/execute.Refactoring
TransactionTypeinto aTransactiontype, so that the time the transaction started could be saved for use with now() / other functions that rely on transaction start time.PreparedPlantype to encapsulate everything the PreparedStatement cache stores for Prepare statements (instead of passing around separate fields in a tuple).GeneratedIdand its corresponding parameter number into aGeneratedParamtype.Shortfalls:
INTERVAL '-08:00' HOUR TO MINUTE. Right now it errors to prevent incorrect behavior falling through. We previously didn't support any kind of timezone parsing whatsoever.Docs: pgdogdev/docs#114.
Helm: pgdogdev/helm#140.
Fixes #1521.