Skip to content

Commit da44e87

Browse files
committed
Fix Now db function to use statement time rather than transaction time
1 parent 66496ba commit da44e87

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
## 5.2.1 - Unreleased
44

55
- Confirmed support for CockroachDB 25.2.x (no code changes required).
6+
- Fixed the ``Now`` database function to use the statement time
7+
(``STATEMENT_TIMESTAMP``) rather than the transaction time
8+
(``CURRENT_TIMESTAMP``).
69

710
## 5.2 - 2025-04-07
811

django_cockroachdb/functions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from django.db.models.expressions import When
77
from django.db.models.functions import (
88
ACos, ASin, ATan, ATan2, Cast, Ceil, Coalesce, Collate, Cos, Cot, Degrees,
9-
Exp, Floor, JSONArray, JSONObject, Ln, Log, Radians, Round, Sin, Sqrt,
9+
Exp, Floor, JSONArray, JSONObject, Ln, Log, Now, Radians, Round, Sin, Sqrt,
1010
StrIndex, Tan,
1111
)
1212

@@ -79,6 +79,7 @@ def register_functions():
7979
Collate.as_cockroachdb = collate
8080
JSONArray.as_cockroachdb = JSONArray.as_postgresql
8181
JSONObject.as_cockroachdb = JSONObject.as_postgresql
82+
Now.as_cockroachdb = Now.as_postgresql
8283
Round.as_cockroachdb = round_cast
8384
StrIndex.as_cockroachdb = StrIndex.as_postgresql
8485
When.as_cockroachdb = when

0 commit comments

Comments
 (0)