fix: use transaction start timestamp for sys.current_date() - #1994
fix: use transaction start timestamp for sys.current_date()#199489799969 wants to merge 1 commit into
Conversation
sys.current_date() is marked STABLE but evaluated GetCurrentTimestamp() (wall clock), so two calls in one statement can differ after pg_sleep. ora_current_timestamp and ora_local_timestamp already use GetCurrentTransactionStartTimestamp(); align current_date with them and with PostgreSQL/Oracle STABLE CURRENT_DATE semantics. Fixes IvorySQL#1697
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthrough
ChangesCurrent date stability
Priority: ➖ Normal Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to The update makes current-date results stable within a transaction as intended and is ready to merge. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks for your PR! |
Summary
Fixes #1697
sys.current_date() is declared STABLE, but ora_current_date() evaluated GetCurrentTimestamp() (wall clock). Two calls in one statement can therefore disagree after pg_sleep, which diverges from Oracle and PostgreSQL CURRENT_DATE.
ora_current_timestamp / ora_local_timestamp in the same file already use GetCurrentTransactionStartTimestamp(). This aligns ora_current_date with them.
Change
`c
// contrib/ivorysql_ora/src/builtin_functions/datetime_datatype_functions.c
`
sysdate() intentionally keeps wall-clock behavior (Oracle SYSDATE is volatile) and is unchanged.
Summary by CodeRabbit
CURRENT_DATEbehavior to consistently reflect the transaction start time rather than the current wall-clock time.