cockroachdb / cockroachdb/cockroach

sql: non-historical statement_timestamp with AOST

Open
#147,474 1 comment 0 reactions 0 assignees View on GitHub
A-sql-builtins branch-release-23.1 C-bug T-sql-queries
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.