MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / GetTxnTimestampNoZone

Method GetTxnTimestampNoZone

pkg/sql/sem/tree/eval.go:3040–3050  ·  view source on GitHub ↗

GetTxnTimestampNoZone retrieves the current transaction timestamp as per the evaluation context. The timestamp is guaranteed to be nonzero.

(precision time.Duration)

Source from the content-addressed store, hash-verified

3038// GetTxnTimestampNoZone retrieves the current transaction timestamp as per
3039// the evaluation context. The timestamp is guaranteed to be nonzero.
3040func (ctx *EvalContext) GetTxnTimestampNoZone(precision time.Duration) *DTimestamp {
3041 // TODO(knz): a zero timestamp should never be read, even during
3042 // Prepare. This will need to be addressed.
3043 if !ctx.PrepareOnly && ctx.TxnTimestamp.IsZero() {
3044 panic(errors.AssertionFailedf("zero transaction timestamp in EvalContext"))
3045 }
3046 // Move the time to UTC, but keeping the location's time.
3047 t := ctx.GetRelativeParseTime()
3048 _, offsetSecs := t.Zone()
3049 return MakeDTimestamp(t.Add(time.Second*time.Duration(offsetSecs)).In(time.UTC), precision)
3050}
3051
3052// GetTxnTime retrieves the current transaction time as per
3053// the evaluation context.

Callers

nothing calls this directly

Calls 3

GetRelativeParseTimeMethod · 0.95
MakeDTimestampFunction · 0.85
AddMethod · 0.65

Tested by

no test coverage detected