Skip to content

Commit

Permalink
sql: don't support AOST queries with synthetic timestamps
Browse files Browse the repository at this point in the history
Informs #101938.

This commit is essentially a revert of 34dc5ae. It removes the ability
to pass a synthetic timestamp to an AOST query.

Release note (backward-incompatible change): AS OF SYSTEM TIME queries
can no longer use a timestamp followed by a question mark to signifiy a
future-time value. This was an undocumented syntax.
  • Loading branch information
nvanbenschoten committed Jan 9, 2024
1 parent 4288a77 commit 48d702d
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions pkg/sql/sem/asof/as_of.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ package asof
import (
"context"
"fmt"
"strings"
"time"

apd "github.com/cockroachdb/apd/v3"
Expand Down Expand Up @@ -244,22 +243,14 @@ func DatumToHLC(
switch d := d.(type) {
case *tree.DString:
s := string(*d)
// Parse synthetic flag.
syn := false
if strings.HasSuffix(s, "?") {
s = s[:len(s)-1]
syn = true
}
// Attempt to parse as timestamp.
if dt, _, err := tree.ParseDTimestampTZ(evalCtx, s, time.Nanosecond); err == nil {
ts.WallTime = dt.Time.UnixNano()
ts.Synthetic = syn
break
}
// Attempt to parse as a decimal.
if dec, _, err := apd.NewFromString(s); err == nil {
ts, convErr = hlc.DecimalToHLC(dec)
ts.Synthetic = syn
break
}
// Attempt to parse as an interval.
Expand All @@ -270,7 +261,6 @@ func DatumToHLC(
convErr = errors.Errorf("interval value %v too small, SPLIT AT interval must be >= %v", d, time.Microsecond)
}
ts.WallTime = duration.Add(stmtTimestamp, iv.Duration).UnixNano()
ts.Synthetic = syn
break
}
convErr = errors.Errorf("value is neither timestamp, decimal, nor interval")
Expand Down

0 comments on commit 48d702d

Please sign in to comment.