cockroachdb / cockroachdb/cockroach
sql: non-historical statement_timestamp with AOST
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
When using historical queries with AS OF SYSTEM TIME, functions that return the transaction timestamp such as `now` and `current_timestamp` and `transaction_timestamp` are set to the historical time. But this is not true for `statement_timestamp` which is set to the current wall time.
According to [PG docs](https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT):
> statement_timestamp() and transaction_timestamp() return the same value during the first command of a transaction, but might differ during subsequent commands.
In order for this to be true, `statement_timestamp` should also be set to the historical time.
Jira issue: CRDB-51068
Contributor guide
Assessment
This issue has not been assessed yet.