diff --git a/go.mod b/go.mod index fa95f7d..02e0f68 100644 --- a/go.mod +++ b/go.mod @@ -1,17 +1,18 @@ module github.com/cockroachdb/cockroachdb-parser -go 1.23.8 +go 1.24 require ( github.com/bazelbuild/rules_go v0.46.0 github.com/biogo/store v0.0.0-20201120204734-aad293a2328f github.com/blevesearch/snowballstem v0.9.0 github.com/cockroachdb/apd/v3 v3.1.0 + github.com/cockroachdb/crlib v0.0.0-20251122031428-fe658a2dbda1 github.com/cockroachdb/errors v1.11.3 github.com/cockroachdb/gostdlib v1.19.0 github.com/cockroachdb/logtags v0.0.0-20241215232642-bb51bb14a506 github.com/cockroachdb/redact v1.1.5 - github.com/cockroachdb/version v0.0.0-20250314144055-3860cd14adf2 + github.com/cockroachdb/version v0.0.0-20250509181251-54dac3003410 github.com/dave/dst v0.27.2 github.com/dustin/go-humanize v1.0.0 github.com/gogo/protobuf v1.3.2 diff --git a/go.sum b/go.sum index 5492e18..82824e9 100644 --- a/go.sum +++ b/go.sum @@ -60,6 +60,8 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cockroachdb/apd/v3 v3.1.0 h1:MK3Ow7LH0W8zkd5GMKA1PvS9qG3bWFI95WaVNfyZJ/w= github.com/cockroachdb/apd/v3 v3.1.0/go.mod h1:6qgPBMXjATAdD/VefbRP9NoSLKjbB4LCoA7gN4LpHs4= +github.com/cockroachdb/crlib v0.0.0-20251122031428-fe658a2dbda1 h1:iX0YCYC5Jbt2/g7zNTP/QxhrV8Syp5kkzNiERKeN1uE= +github.com/cockroachdb/crlib v0.0.0-20251122031428-fe658a2dbda1/go.mod h1:NjNuToN/FbhwH1cCyM9G4Rhtxx+ZaOgtoqFR+thng7w= github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I= github.com/cockroachdb/errors v1.11.3/go.mod h1:m4UIW4CDjx+R5cybPsNrRbreomiFqt8o1h1wUVazSd8= github.com/cockroachdb/gostdlib v1.19.0 h1:cSISxkVnTlWhTkyple/T6NXzOi5659FkhxvUgZv+Eb0= @@ -68,8 +70,8 @@ github.com/cockroachdb/logtags v0.0.0-20241215232642-bb51bb14a506 h1:ASDL+UJcILM github.com/cockroachdb/logtags v0.0.0-20241215232642-bb51bb14a506/go.mod h1:Mw7HqKr2kdtu6aYGn3tPmAftiP3QPX63LdK/zcariIo= github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= -github.com/cockroachdb/version v0.0.0-20250314144055-3860cd14adf2 h1:8Vfw2iNEpYIV6aLtMwT5UOGuPmp9MKlEKWKFTuB+MPU= -github.com/cockroachdb/version v0.0.0-20250314144055-3860cd14adf2/go.mod h1:P9WiZOdQ1R/ZZDL0WzF5wlyRvrjtfhNOwMZymFpBwjE= +github.com/cockroachdb/version v0.0.0-20250509181251-54dac3003410 h1:GuIAxxl30gmd9m7ct6fgYb49GUv8GAxICU5VfU9GRvc= +github.com/cockroachdb/version v0.0.0-20250509181251-54dac3003410/go.mod h1:P9WiZOdQ1R/ZZDL0WzF5wlyRvrjtfhNOwMZymFpBwjE= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= diff --git a/patches/0007-update-functions-parser.patch b/patches/0007-update-functions-parser.patch index b31a67e..792bf87 100644 --- a/patches/0007-update-functions-parser.patch +++ b/patches/0007-update-functions-parser.patch @@ -5,7 +5,7 @@ index 4f7bc03..5b31fd0 100644 @@ -51,6 +51,13 @@ const ( // as Oracle is case insensitive if object name is not quoted. EncAlwaysQuoted - + + // EncSkipEscapeString indicates that the string should not be escaped, + // and non-ASCII characters are allowed. + // More specifically, it means that the tree.DString won't be wrapped @@ -27,7 +27,7 @@ index 4f7bc03..5b31fd0 100644 @@ -165,7 +173,13 @@ func EncodeSQLStringWithFlags(buf *bytes.Buffer, in string, flags EncodeFlags) { } } - + - if !escapedString { + // If non-ASCII characters are allowed, + // skip escaping and write the original UTF-8 character. @@ -48,7 +48,7 @@ index 4f7bc03..5b31fd0 100644 + // quote char, so we will write the quote char directly. + stringencoding.EncodeEscapedChar(buf, in, r, ch, i, '\'', !skipEscape) } - + - quote := !escapedString && !bareStrings + quote := !escapedString && !bareStrings && !skipEscape if quote { @@ -69,7 +69,7 @@ index 05d64e1..dabff21 100644 @@ -1364,6 +1364,19 @@ const ( OrderedSetAgg ) - + +// onlyNameFunc is the list of function who can be compiled with only the +// name. This is for PG compatibility, where examples such as `CURRENT_TIMESTAMP()` +// is not allowed, but `CURRENT_TIMESTAMP` is allowed. @@ -89,7 +89,7 @@ index 05d64e1..dabff21 100644 @@ -1385,41 +1398,43 @@ func (node *FuncExpr) Format(ctx *FmtCtx) { ctx.FormatNode(&node.Func) }) - + - ctx.WriteByte('(') - ctx.WriteString(typ) - ctx.FormatNode(&node.Exprs) @@ -168,22 +168,22 @@ index 6832c7e..df15c15 100644 --- a/pkg/sql/sem/tree/format.go +++ b/pkg/sql/sem/tree/format.go @@ -195,6 +195,10 @@ const ( - // FmtSkipAsOfSystemTimeClauses prevents the formatter from printing AS OF - // SYSTEM TIME clauses. - FmtSkipAsOfSystemTimeClauses + // FmtPLpgSQLParen will wrap some expressions in parenthesis when in PLpgSQL + // context. This should only be used in tests. + FmtPLpgSQLParen + + // FmtFuncOnlyName instructs the formating for a function only print + // its name, without printing the body of the function nor with the brackets. + FmtFuncOnlyName ) - + const genericArityIndicator = "__more__" diff --git a/pkg/util/stringencoding/string_encoding.go b/pkg/util/stringencoding/string_encoding.go index fcb7fac..afa0090 100644 --- a/pkg/util/stringencoding/string_encoding.go +++ b/pkg/util/stringencoding/string_encoding.go @@ -73,6 +73,7 @@ func init() { - + // EncodeEscapedChar is used internally to write out a character from a larger // string that needs to be escaped to a buffer. +// If slashedQuoteChar is true, it will write a backslash before the quoteChar. diff --git a/pkg/build/bazel/util/tinystringer/main.go b/pkg/build/bazel/util/tinystringer/main.go index ec63f54..b5153b3 100644 --- a/pkg/build/bazel/util/tinystringer/main.go +++ b/pkg/build/bazel/util/tinystringer/main.go @@ -332,7 +332,7 @@ func (s tinyStringer) computeConstantValues( if genDecl.Tok != token.CONST { continue } - var inferAppropriateType, inIota bool + var inferAppropriateType, inIota, inShift bool var iotaVal int for _, spec := range genDecl.Specs { valueSpec, ok := spec.(*ast.ValueSpec) @@ -360,7 +360,11 @@ func (s tinyStringer) computeConstantValues( if valueSpec.Values == nil { if inIota { nameToInt[constName] = iotaVal - iotaVal += 1 + if inShift { + iotaVal <<= 1 + } else { + iotaVal += 1 + } } else { nameToInt[constName] = 0 } @@ -401,19 +405,26 @@ func (s tinyStringer) computeConstantValues( inIota = false } } else if binExpr, ok := valueSpec.Values[0].(*ast.BinaryExpr); ok { - // Handle iota + N or iota - N. - iotaIdent, ok := binExpr.X.(*ast.Ident) + inShift = false + xArg, yArg := binExpr.X, binExpr.Y + if binExpr.Op == token.SHL { + // Handle 1 << iota - the order of arguments is switched. + inShift = true + xArg, yArg = yArg, xArg + } + // Handle iota + N, iota - N, 1 << iota. + iotaIdent, ok := xArg.(*ast.Ident) if !ok || iotaIdent.Name != "iota" { - err = fmt.Errorf("expected 'iota' in binary expression %+v; found %+v", binExpr, binExpr.X) + err = fmt.Errorf("expected 'iota' in binary expression %+v; found %+v", binExpr, xArg) return } var otherNumParsed int64 - if otherNum, ok := binExpr.Y.(*ast.BasicLit); ok && otherNum.Kind == token.INT { + if otherNum, ok := yArg.(*ast.BasicLit); ok && otherNum.Kind == token.INT { otherNumParsed, err = strconv.ParseInt(otherNum.Value, 0, 0) if err != nil { return } - } else if otherRef, ok := binExpr.Y.(*ast.Ident); ok { + } else if otherRef, ok := yArg.(*ast.Ident); ok { otherNum, ok := nameToInt[otherRef.Name] if !ok { err = fmt.Errorf("could not find value of %s", otherRef.Name) @@ -421,17 +432,28 @@ func (s tinyStringer) computeConstantValues( } otherNumParsed = int64(otherNum) } else { - err = fmt.Errorf("couldn't parse second argument of binary expression %+v; found %+v", binExpr, binExpr.Y) + err = fmt.Errorf("couldn't parse second argument of binary expression %+v; found %+v", binExpr, yArg) return } if binExpr.Op == token.ADD { iotaVal = iotaVal + int(otherNumParsed) } else if binExpr.Op == token.SUB { iotaVal = iotaVal - int(otherNumParsed) + } else if binExpr.Op == token.SHL { + // We currently assume 1 << iota and not N << iota. + if otherNumParsed != 1 { + err = fmt.Errorf("only 1 << iota is supported; found %d << iota", otherNumParsed) + return + } + iotaVal = int(otherNumParsed) } inIota = true nameToInt[constName] = iotaVal - iotaVal += 1 + if inShift { + iotaVal <<= 1 + } else { + iotaVal += 1 + } } else { err = fmt.Errorf("don't know how to process %+v", valueSpec.Values[0]) return diff --git a/pkg/build/info.go b/pkg/build/info.go index ec7ede1..d92ba7e 100644 --- a/pkg/build/info.go +++ b/pkg/build/info.go @@ -7,6 +7,7 @@ package build import ( "bytes" + "crypto/fips140" _ "embed" "fmt" "runtime" @@ -35,8 +36,9 @@ var ( channel string ) -// Distribution is changed by the CCL init-time hook in non-APL builds. -var Distribution = "OSS" +// Distribution is a historical artifact from when we had OSS and non-OSS (CCL) +// builds. +const Distribution = "CCL" var ( cgoCompiler = cgoVersion() @@ -107,16 +109,16 @@ func BinaryVersion() string { // It returns "vX.Y" for all release versions, and all prerelease versions >= "alpha.1". // X and Y are the major and minor, respectively, of the version specified in version.txt. // For all other prerelease versions, it returns "dev". -// N.B. new public-facing doc URLs are expected to be up beginning with the "alpha.1" prerelease. Otherwise, "dev" will +// N.B. new public-facing doc URLs are expected to be up once the "alpha.1" prerelease is shipped. Otherwise, "dev" will // cause the url mapper to redirect to the latest stable release. func VersionForURLs() string { if parsedVersionTxt.IsPrerelease() { phaseAndOrdinal := parsedVersionTxt.Format("%P.%o") - // builds prior to "alpha.1" use 'dev' in their URLs - if phaseAndOrdinal < "alpha.1" { + // builds use 'dev' in their URLs until "alpha.1" is shipped + if phaseAndOrdinal <= "alpha.1" { return "dev" } - } else if parsedVersionTxt.IsCustomOrNightlyBuild() { + } else if parsedVersionTxt.IsCustomOrAdhocBuild() { return "dev" } return parsedVersionTxt.Major().String() @@ -168,6 +170,10 @@ func (b Info) Long() string { fmt.Fprintf(tw, "C Compiler: %s\n", b.CgoCompiler) fmt.Fprintf(tw, "Build Commit ID: %s\n", b.Revision) fmt.Fprintf(tw, "Build Type: %s\n", b.Type) + if fips140.Enabled() { + fmt.Fprintf(tw, "FIPS enabled: true\n") + } + fmt.Fprintf(tw, "Enabled Assertions: %t", b.EnabledAssertions) // No final newline: cobra prints one for us. _ = tw.Flush() return buf.String() diff --git a/pkg/col/coldata/json.go b/pkg/col/coldata/json.go index 4cdd855..acc3237 100644 --- a/pkg/col/coldata/json.go +++ b/pkg/col/coldata/json.go @@ -15,9 +15,12 @@ import ( // JSONs is a representation of columnar JSON data. It's simply a wrapper around // the flat Bytes structure. To pull a JSON out of the structure, we construct -// a new "encodedJSON" object from scratch on demand. +// a new JSONEncoded object from scratch on demand. type JSONs struct { Bytes + // jsonScratch batches allocations of JSONEncoded objects (under the + // assumption that the vector doesn't have NULLs). + jsonScratch []json.JSONEncoded // scratch is a scratch space for encoding a JSON object on demand. scratch []byte } @@ -25,7 +28,8 @@ type JSONs struct { // NewJSONs returns a new JSONs presized to n elements. func NewJSONs(n int) *JSONs { return &JSONs{ - Bytes: *NewBytes(n), + Bytes: *NewBytes(n), + jsonScratch: make([]json.JSONEncoded, n), } } @@ -38,11 +42,12 @@ func (js *JSONs) Get(i int) json.JSON { if len(bytes) == 0 { return json.NullJSONValue } - ret, err := json.FromEncoding(bytes) + j := &js.jsonScratch[i] + err := json.FromEncodingInto(bytes, j) if err != nil { colexecerror.ExpectedError(err) } - return ret + return j } // Set sets the ith JSON in JSONs. @@ -62,6 +67,13 @@ func (js *JSONs) Set(i int, j json.JSON) { func (js *JSONs) Window(start, end int) *JSONs { return &JSONs{ Bytes: *js.Bytes.Window(start, end), + // TODO(yuzefovich): in the general case, if we simply reused + // js.jsonScratch here, it could lead to problems down the line (because + // Get calls on js and on the window into js would be reusing the same + // JSONEncoded object). However, in practice the windowed batch should + // be consumed soon after it's created, without the overlap with Gets on + // the original batch. Think through this. + jsonScratch: make([]json.JSONEncoded, end-start), } } @@ -81,12 +93,14 @@ func (js *JSONs) CopySlice(src *JSONs, destIdx, srcStartIdx, srcEndIdx int) { // values from src into the receiver starting at destIdx. func (js *JSONs) AppendSlice(src *JSONs, destIdx, srcStartIdx, srcEndIdx int) { js.Bytes.AppendSlice(&src.Bytes, destIdx, srcStartIdx, srcEndIdx) + js.ensureJSONScratch() } // appendSliceWithSel appends all values specified in sel from the source into // the receiver starting at position destIdx. func (js *JSONs) appendSliceWithSel(src *JSONs, destIdx int, sel []int) { js.Bytes.appendSliceWithSel(&src.Bytes, destIdx, sel) + js.ensureJSONScratch() } // String is used for debugging purposes. @@ -99,3 +113,18 @@ func (js *JSONs) String() string { } return builder.String() } + +// Deserialize updates b according to the "arrow-like" format that was produced +// by Serialize. +func (js *JSONs) Deserialize(data []byte, offsets []int32) { + js.Bytes.Deserialize(data, offsets) + js.ensureJSONScratch() +} + +func (js *JSONs) ensureJSONScratch() { + if cap(js.jsonScratch) < js.Bytes.Len() { + js.jsonScratch = make([]json.JSONEncoded, js.Bytes.Len()) + } else { + js.jsonScratch = js.jsonScratch[:js.Bytes.Len()] + } +} diff --git a/pkg/col/coldata/vec.go b/pkg/col/coldata/vec.go index 3e21f45..1ba471c 100644 --- a/pkg/col/coldata/vec.go +++ b/pkg/col/coldata/vec.go @@ -11,6 +11,7 @@ import ( "github.com/cockroachdb/cockroachdb-parser/pkg/col/typeconv" "github.com/cockroachdb/cockroachdb-parser/pkg/sql/types" + "github.com/cockroachdb/cockroachdb-parser/pkg/util/json" ) // Column is an interface that represents a raw array of a Go native type. @@ -160,11 +161,14 @@ func (cf *defaultColumnFactory) MakeColumns(columns []Column, t *types.T, length } case types.JsonFamily: alloc := make([]element, allocLength) + jsonScratchAlloc := make([]json.JSONEncoded, allocLength) wrapperAlloc := make([]JSONs, len(columns)) for i := range columns { wrapperAlloc[i].elements = alloc[:length:length] + wrapperAlloc[i].jsonScratch = jsonScratchAlloc[:length:length] columns[i] = &wrapperAlloc[i] alloc = alloc[length:] + jsonScratchAlloc = jsonScratchAlloc[length:] } default: panic(fmt.Sprintf("StandardColumnFactory doesn't support %s", t)) diff --git a/pkg/geo/geomfn/distance.go b/pkg/geo/geomfn/distance.go index 324ea21..029f2e8 100644 --- a/pkg/geo/geomfn/distance.go +++ b/pkg/geo/geomfn/distance.go @@ -220,7 +220,7 @@ func distanceInternal( aIt := geo.NewGeomTIterator(aGeomT, emptyBehavior) aGeom, aNext, aErr := aIt.Next() if aErr != nil { - return 0, err + return 0, aErr } for aNext { aGeodist, err := geomToGeodist(aGeom) @@ -231,7 +231,7 @@ func distanceInternal( bIt := geo.NewGeomTIterator(bGeomT, emptyBehavior) bGeom, bNext, bErr := bIt.Next() if bErr != nil { - return 0, err + return 0, bErr } for bNext { bGeodist, err := geomToGeodist(bGeom) @@ -248,13 +248,13 @@ func distanceInternal( bGeom, bNext, bErr = bIt.Next() if bErr != nil { - return 0, err + return 0, bErr } } aGeom, aNext, aErr = aIt.Next() if aErr != nil { - return 0, err + return 0, aErr } } return c.DistanceUpdater().Distance(), nil diff --git a/pkg/geo/geomfn/mvtgeom.go b/pkg/geo/geomfn/mvtgeom.go index d2c6149..89b5f1c 100644 --- a/pkg/geo/geomfn/mvtgeom.go +++ b/pkg/geo/geomfn/mvtgeom.go @@ -6,6 +6,8 @@ package geomfn import ( + "sort" + "github.com/cockroachdb/cockroachdb-parser/pkg/geo" "github.com/cockroachdb/cockroachdb-parser/pkg/geo/geopb" "github.com/cockroachdb/cockroachdb-parser/pkg/sql/pgwire/pgcode" @@ -111,6 +113,15 @@ func transformToMVTGeom( if out.Empty() { return geo.Geometry{}, nil } + + // Sort multipoint coordinates by (X, Y) to match PostGIS behavior. + // PostGIS sorts multipoints as part of its duplicate removal algorithm + // in lwgeom_remove_repeated_points_in_place. + out, err = sortMultiPointCoords(out) + if err != nil { + return geo.Geometry{}, errors.Wrap(err, "failed to sort multipoint coordinates") + } + return out, nil } @@ -147,23 +158,31 @@ func clipAndValidateMVTOutput( bbox.LoY = overwriteMinusZero(-float64(buffer)) g, err = ClipByRect(g, bbox) if err != nil { - return geo.Geometry{}, errors.Wrap(err, "failed to clip geometry") + // Clipping can fail on degenerate geometries (e.g., polygons that + // collapsed to too few points after snapping). PostGIS's Wagyu clipper + // handles these gracefully and returns NULL. + return geo.Geometry{}, nil //nolint:returnerrcheck } } g, err = snapToGridAndValidate(g, inputBasicType) if err != nil { - return geo.Geometry{}, errors.Wrap(err, "failed to grid and validate") + // Snapping and validation can fail on degenerate geometries. PostGIS + // returns NULL in these cases. + return geo.Geometry{}, nil //nolint:returnerrcheck } outputGt, err := g.AsGeomT() if err != nil { - return geo.Geometry{}, errors.Wrap(err, "failed to convert geometry into geom.T") + // Degenerate geometries can fail to parse. PostGIS returns NULL. + return geo.Geometry{}, nil //nolint:returnerrcheck } outputBasicType, err := getBasicType(outputGt) if err != nil { - return geo.Geometry{}, err + return geo.Geometry{}, nil //nolint:returnerrcheck } if inputBasicType != outputBasicType { - return geo.Geometry{}, errors.New("geometry dropped because of output type change") + // The geometry's type changed during clipping/validation (e.g., a polygon + // collapsed to a line). PostGIS returns NULL in this case. + return geo.Geometry{}, nil } return g, nil } @@ -243,6 +262,53 @@ func snapToGridAndValidateBasicPolygon( return g, nil } +// sortMultiPointCoords sorts the coordinates of a MultiPoint geometry by +// (X, Y) ascending. This matches PostGIS behavior, which sorts multipoints +// during duplicate removal in lwgeom_remove_repeated_points_in_place. +// For non-MultiPoint geometries, this is a no-op. +func sortMultiPointCoords(g geo.Geometry) (geo.Geometry, error) { + gt, err := g.AsGeomT() + if err != nil { + return g, err + } + mpt, ok := gt.(*geom.MultiPoint) + if !ok || mpt.NumPoints() <= 1 { + return g, nil + } + + // Collect all point coordinates. + type pointCoord struct { + x, y float64 + } + points := make([]pointCoord, mpt.NumPoints()) + for i := 0; i < mpt.NumPoints(); i++ { + c := mpt.Point(i).Coords() + points[i] = pointCoord{c.X(), c.Y()} + } + + // Sort by X ascending, then Y ascending. + sort.Slice(points, func(i, j int) bool { + if points[i].x != points[j].x { + return points[i].x < points[j].x + } + return points[i].y < points[j].y + }) + + // Build a new MultiPoint with sorted coordinates. + layout := mpt.Layout() + stride := layout.Stride() + flatCoords := make([]float64, 0, len(points)*stride) + for _, p := range points { + c := make([]float64, stride) + c[0] = p.x + c[1] = p.y + flatCoords = append(flatCoords, c...) + } + sorted := geom.NewMultiPointFlat(layout, flatCoords).SetSRID(mpt.SRID()) + + return geo.MakeGeometryFromGeomT(sorted) +} + func snapToIntegersGrid(g geo.Geometry) (geo.Geometry, error) { offset := geom.Coord{0, 0, 0, 0} grid := geom.Coord{1, 1, 0, 0} diff --git a/pkg/geo/geomfn/snap.go b/pkg/geo/geomfn/snap.go index 75c3ba8..8e85451 100644 --- a/pkg/geo/geomfn/snap.go +++ b/pkg/geo/geomfn/snap.go @@ -14,6 +14,11 @@ import ( // geometry. Tolerance is used to control where snapping is performed. // If no snapping occurs then the input geometry is returned unchanged. func Snap(input, target geo.Geometry, tolerance float64) (geo.Geometry, error) { + if input.Empty() { + // If input is empty, return it unchanged (snap has no effect on empty + // geoms). + return input, nil + } snappedEWKB, err := geos.Snap(input.EWKB(), target.EWKB(), tolerance) if err != nil { return geo.Geometry{}, err diff --git a/pkg/geo/geomfn/unary_operators.go b/pkg/geo/geomfn/unary_operators.go index 571d5d2..34c9bfb 100644 --- a/pkg/geo/geomfn/unary_operators.go +++ b/pkg/geo/geomfn/unary_operators.go @@ -6,6 +6,8 @@ package geomfn import ( + "math" + "github.com/cockroachdb/cockroachdb-parser/pkg/geo" "github.com/cockroachdb/cockroachdb-parser/pkg/geo/geos" "github.com/cockroachdb/errors" @@ -242,3 +244,84 @@ func CountVertices(t geom.T) int { return len(t.FlatCoords()) / t.Stride() } } + +// length3DLineString returns the length of a +// given 3D LINESTRING. Returns an error if +// lineString does not have a z-coordinate. +func length3DLineString(lineString *geom.LineString) (float64, error) { + lineCoords := lineString.Coords() + zIndex := lineString.Layout().ZIndex() + if zIndex < 0 || zIndex >= lineString.Stride() { + return 0, errors.AssertionFailedf("Z-Index for LINESTRING is out-of-bounds") + } + lineLength := float64(0) + for i := 1; i < len(lineCoords); i++ { + prevPoint, curPoint := lineCoords[i-1], lineCoords[i] + deltaX := curPoint.X() - prevPoint.X() + deltaY := curPoint.Y() - prevPoint.Y() + deltaZ := curPoint[zIndex] - prevPoint[zIndex] + distBetweenPoints := math.Sqrt(deltaX*deltaX + deltaY*deltaY + deltaZ*deltaZ) + lineLength += distBetweenPoints + } + + return lineLength, nil +} + +// length3DMultiLineString returns the length of a +// given 3D MULTILINESTRING. Returns an error if +// multiLineString is not 3D. +func length3DMultiLineString(multiLineString *geom.MultiLineString) (float64, error) { + multiLineLength := 0.0 + for i := 0; i < multiLineString.NumLineStrings(); i++ { + lineLength, err := length3DLineString(multiLineString.LineString(i)) + if err != nil { + return 0, err + } + multiLineLength += lineLength + } + + return multiLineLength, nil +} + +// Length3D returns the length of a given Geometry. +// Compatible with 3D geometries. +// Note only (MULTI)LINESTRING objects have a length. +func Length3D(g geo.Geometry) (float64, error) { + geomRepr, err := g.AsGeomT() + if err != nil { + return 0, err + } + + switch geomRepr.Layout() { + case geom.XYZ, geom.XYZM: + return length3DFromGeomT(geomRepr) + } + // Call default length + return lengthFromGeomT(geomRepr) +} + +// length3DFromGeomT returns the length from a geom.T, recursing down +// GeometryCollections if required. +// Compatible with 3D geometries. +func length3DFromGeomT(geomRepr geom.T) (float64, error) { + switch geomRepr := geomRepr.(type) { + case *geom.Point, *geom.MultiPoint, *geom.Polygon, *geom.MultiPolygon: + return 0, nil + case *geom.LineString: + return length3DLineString(geomRepr) + case *geom.MultiLineString: + return length3DMultiLineString(geomRepr) + case *geom.GeometryCollection: + total := float64(0) + for _, subG := range geomRepr.Geoms() { + subLength, err := length3DFromGeomT(subG) + if err != nil { + return 0, err + } + total += subLength + } + return total, nil + default: + return 0, errors.AssertionFailedf("unknown geometry type: %T", geomRepr) + } +} diff --git a/pkg/geo/geoproj/zcgo_flags.go b/pkg/geo/geoproj/zcgo_flags.go index 5e06e73..834485d 100644 --- a/pkg/geo/geoproj/zcgo_flags.go +++ b/pkg/geo/geoproj/zcgo_flags.go @@ -2,6 +2,6 @@ package geoproj -// #cgo CPPFLAGS: -I/Users/jeremyyang/go/src/github.com/cockroachdb/cockroachdb-parser/bin/c-deps/archived_cdep_libjemalloc_macosarm/include -// #cgo LDFLAGS: -L/Users/jeremyyang/go/src/github.com/cockroachdb/cockroachdb-parser/bin/c-deps/archived_cdep_libjemalloc_macosarm/lib -L/Users/jeremyyang/go/src/github.com/cockroachdb/cockroachdb-parser/bin/c-deps/archived_cdep_libproj_macosarm/lib +// #cgo CPPFLAGS: -I/mnt/scratch/git/cockroach-2/bin/c-deps/archived_cdep_libjemalloc_linux/include -I/mnt/scratch/git/cockroach-2/bin/c-deps/archived_cdep_libkrb5_linux/include +// #cgo LDFLAGS: -L/mnt/scratch/git/cockroach-2/bin/c-deps/archived_cdep_libjemalloc_linux/lib -L/mnt/scratch/git/cockroach-2/bin/c-deps/archived_cdep_libproj_linux/lib -L/mnt/scratch/git/cockroach-2/bin/c-deps/archived_cdep_libkrb5_linux/lib import "C" diff --git a/pkg/security/username/username.go b/pkg/security/username/username.go index 0edcdba..8016cc1 100644 --- a/pkg/security/username/username.go +++ b/pkg/security/username/username.go @@ -160,6 +160,12 @@ const TestUser = "testuser" // TestUserName is the SQLUsername for testuser. func TestUserName() SQLUsername { return SQLUsername{TestUser} } +// DebugUser is used for collecting debug zip. +const DebugUser = "debug_user" + +// DebugUserName is the SQLUsername for debug user. +func DebugUserName() SQLUsername { return SQLUsername{DebugUser} } + // MakeSQLUsernameFromUserInput normalizes a username string as // entered in an ambiguous context into a SQL username (performs case // folding and unicode normalization form C - NFC). diff --git a/pkg/settings/byte_size.go b/pkg/settings/byte_size.go index 093e6e3..3286d1b 100644 --- a/pkg/settings/byte_size.go +++ b/pkg/settings/byte_size.go @@ -60,7 +60,7 @@ func RegisterByteSizeSetting( } hasExplicitValidationFn = true if err := opt.validateInt64Fn(v); err != nil { - return errors.Wrapf(err, "invalid value for %s", key) + return err } } if !hasExplicitValidationFn { @@ -92,3 +92,14 @@ func ByteSizeWithMinimum(minVal int64) SettingOption { return nil }) } + +// ByteSizeWithMaximum can be passed to RegisterByteSizeSetting. +func ByteSizeWithMaximum(maxVal int64) SettingOption { + return WithValidateInt(func(v int64) error { + if v > maxVal { + return errors.Errorf("cannot be set to a value larger than %v", + humanizeutil.IBytes(maxVal)) + } + return nil + }) +} diff --git a/pkg/settings/common.go b/pkg/settings/common.go index 52343a6..8301e6a 100644 --- a/pkg/settings/common.go +++ b/pkg/settings/common.go @@ -14,13 +14,15 @@ import ( // common implements basic functionality used by all setting types. type common struct { - class Class + slot slotIdx + + class Class + visibility Visibility + key InternalKey name SettingName description string - visibility Visibility unsafe bool - slot slotIdx nonReportable bool retired bool sensitive bool @@ -67,7 +69,7 @@ func (c common) Visibility() Visibility { return c.visibility } -func (c common) isReportable() bool { +func (c common) IsReportable() bool { return !c.nonReportable } @@ -75,7 +77,7 @@ func (c *common) isRetired() bool { return c.retired } -func (c *common) isSensitive() bool { +func (c *common) IsSensitive() bool { return c.sensitive } @@ -150,17 +152,17 @@ type internalSetting interface { init(class Class, key InternalKey, description string, slot slotIdx) isRetired() bool - isSensitive() bool + IsSensitive() bool getSlot() slotIdx - // isReportable indicates whether the value of the setting can be + // IsReportable indicates whether the value of the setting can be // included in user-facing reports such as that produced by SHOW ALL // CLUSTER SETTINGS. // This only affects reports though; direct access is unconstrained. // For example, `enterprise.license` is non-reportable: // it cannot be listed, but can be accessed with `SHOW CLUSTER // SETTING enterprise.license` or SET CLUSTER SETTING. - isReportable() bool + IsReportable() bool setToDefault(ctx context.Context, sv *Values) @@ -179,7 +181,7 @@ func TestingIsReportable(s Setting) bool { return false } if e, ok := s.(internalSetting); ok { - return e.isReportable() + return e.IsReportable() } return true } @@ -187,7 +189,7 @@ func TestingIsReportable(s Setting) bool { // TestingIsSensitive is used in testing for sensitivity. func TestingIsSensitive(s Setting) bool { if e, ok := s.(internalSetting); ok { - return e.isSensitive() + return e.IsSensitive() } return false } diff --git a/pkg/settings/duration.go b/pkg/settings/duration.go index 4c5e1d8..f149d8b 100644 --- a/pkg/settings/duration.go +++ b/pkg/settings/duration.go @@ -147,11 +147,14 @@ func (d *DurationSetting) setToDefault(ctx context.Context, sv *Values) { } } -// RegisterDurationSetting defines a new setting with type duration. +// RegisterDurationSetting defines a new setting with type duration and any +// supplied validation function(s). If no validation functions are given, then +// the non-negative duration validation is performed. func RegisterDurationSetting( class Class, key InternalKey, desc string, defaultValue time.Duration, opts ...SettingOption, ) *DurationSetting { validateFn := func(val time.Duration) error { + hasExplicitValidationFn := false for _, opt := range opts { switch { case opt.commonOpt != nil: @@ -160,10 +163,15 @@ func RegisterDurationSetting( default: panic(errors.AssertionFailedf("wrong validator type")) } + hasExplicitValidationFn = true if err := opt.validateDurationFn(val); err != nil { - return errors.Wrapf(err, "invalid value for %s", key) + return err } } + if !hasExplicitValidationFn { + // Default validation. + return nonNegativeDurationInternal(val) + } return nil } @@ -179,13 +187,14 @@ func RegisterDurationSetting( return setting } -// RegisterPublicDurationSettingWithExplicitUnit defines a new -// public setting with type duration which requires an explicit unit when being -// set. +// RegisterDurationSettingWithExplicitUnit defines a new setting with type +// duration which requires an explicit unit when being set. If no validation +// functions are given, then the non-negative duration validation is performed. func RegisterDurationSettingWithExplicitUnit( class Class, key InternalKey, desc string, defaultValue time.Duration, opts ...SettingOption, ) *DurationSettingWithExplicitUnit { validateFn := func(val time.Duration) error { + hasExplicitValidationFn := false for _, opt := range opts { switch { case opt.commonOpt != nil: @@ -194,10 +203,15 @@ func RegisterDurationSettingWithExplicitUnit( default: panic(errors.AssertionFailedf("wrong validator type")) } + hasExplicitValidationFn = true if err := opt.validateDurationFn(val); err != nil { - return errors.Wrapf(err, "invalid value for %s", key) + return err } } + if !hasExplicitValidationFn { + // Default validation. + return nonNegativeDurationInternal(val) + } return nil } if err := validateFn(defaultValue); err != nil { @@ -214,10 +228,6 @@ func RegisterDurationSettingWithExplicitUnit( return setting } -// NonNegativeDuration checks that the duration is greater or equal to -// zero. It can be passed to RegisterDurationSetting. -var NonNegativeDuration SettingOption = WithValidateDuration(nonNegativeDurationInternal) - func nonNegativeDurationInternal(v time.Duration) error { if v < 0 { return errors.Errorf("cannot be set to a negative duration: %s", v) diff --git a/pkg/settings/enum.go b/pkg/settings/enum.go index 14ca86c..35131c9 100644 --- a/pkg/settings/enum.go +++ b/pkg/settings/enum.go @@ -13,6 +13,7 @@ import ( "strconv" "strings" + "github.com/cockroachdb/errors" "golang.org/x/exp/constraints" ) @@ -22,6 +23,7 @@ type EnumSetting[T constraints.Integer] struct { defaultValue T // enumValues maps each valid value of T to a lowercase string. enumValues map[T]string + validateFn func(string) error } // AnyEnumSetting is an interface that is used when the specific enum type T is @@ -29,6 +31,9 @@ type EnumSetting[T constraints.Integer] struct { type AnyEnumSetting interface { internalSetting + // Validate validates the enum value. + Validate(value int64) error + // ParseEnum parses a string that is either a string in enumValues or an // integer and returns the enum value as an int64 (and a boolean that // indicates if it was parseable). @@ -85,11 +90,22 @@ func (e *EnumSetting[T]) setToDefault(ctx context.Context, sv *Values) { // See if the default value was overridden. if val := sv.getDefaultOverride(e.slot); val != nil { // As per the semantics of override, these values don't go through - // validation. - sv.setInt64(ctx, e.slot, val.(int64)) + // validation. TODO(wenyihu6): there seems to be a bug here. See more in + // #149982. + _ = e.set(ctx, sv, val.(int64)) return } - sv.setInt64(ctx, e.slot, int64(e.defaultValue)) + if err := e.set(ctx, sv, int64(e.defaultValue)); err != nil { + panic(err) + } +} + +func (e *EnumSetting[T]) set(ctx context.Context, sv *Values, v int64) error { + if err := e.Validate(v); err != nil { + return err + } + sv.setInt64(ctx, e.slot, v) + return nil } func (e *EnumSetting[T]) decodeAndSet(ctx context.Context, sv *Values, encoded string) error { @@ -97,6 +113,9 @@ func (e *EnumSetting[T]) decodeAndSet(ctx context.Context, sv *Values, encoded s if err != nil { return err } + if err := e.Validate(v); err != nil { + return err + } sv.setInt64(ctx, e.slot, v) return nil } @@ -124,6 +143,26 @@ func (e *EnumSetting[T]) DecodeToString(encoded string) (string, error) { return encoded, nil } +// parseEnumInt64 converts an int64 to its enum string value for validation. +// The string value is used by validateFn to validate the enum. +func (e *EnumSetting[T]) parseEnumInt64(value int64) (string, bool) { + for k, v := range e.enumValues { + if value == int64(k) { + return v, true + } + } + return "", false +} + +// Validate validates the enum value. +func (e *EnumSetting[T]) Validate(value int64) error { + parsed, ok := e.parseEnumInt64(value) + if !ok { + return fmt.Errorf("invalid enum value: %d", value) + } + return e.validateFn(parsed) +} + // ParseEnum parses a string that is either a string in enumValues or an integer // and returns the enum value as an int64 (and a boolean that indicates if it // was parseable). @@ -212,6 +251,22 @@ func RegisterEnumSetting[T constraints.Integer]( enumValuesLower[k] = strings.ToLower(v) } + validateFn := func(val string) error { + for _, opt := range opts { + switch { + case opt.commonOpt != nil: + continue + case opt.validateEnumFn != nil: + default: + panic(errors.AssertionFailedf("wrong validator type")) + } + if err := opt.validateEnumFn(val); err != nil { + return err + } + } + return nil + } + defaultVal := func() T { for k, v := range enumValues { if v == defaultValue { @@ -221,9 +276,14 @@ func RegisterEnumSetting[T constraints.Integer]( panic(fmt.Sprintf("enum registered with default value %s not in map %s", defaultValue, enumValuesToDesc(enumValuesLower))) }() + if err := validateFn(defaultValue); err != nil { + panic(errors.Wrap(err, "invalid default")) + } + setting := &EnumSetting[T]{ defaultValue: defaultVal, enumValues: enumValuesLower, + validateFn: validateFn, } register(class, key, fmt.Sprintf("%s %s", desc, enumValuesToDesc(enumValues)), setting) diff --git a/pkg/settings/masked.go b/pkg/settings/masked.go index 8776cdb..a3c9310 100644 --- a/pkg/settings/masked.go +++ b/pkg/settings/masked.go @@ -35,7 +35,7 @@ func (s *MaskedSetting) String(sv *Values) string { } isSensitive := false if st, ok := s.setting.(internalSetting); ok { - isSensitive = st.isSensitive() + isSensitive = st.IsSensitive() } sensitiveRedactionEnabled := redactSensitiveSettingsEnabled.Get(sv) // Non-reportable settings are always redacted. Sensitive settings are @@ -56,6 +56,16 @@ func (s *MaskedSetting) Visibility() Visibility { return s.setting.Visibility() } +// IsSensitive returns whether the underlying setting is sensitive. +func (s *MaskedSetting) IsSensitive() bool { + return s.setting.IsSensitive() +} + +// IsReportable returns whether the underlying setting is reportable. +func (s *MaskedSetting) IsReportable() bool { + return s.setting.IsReportable() +} + // InternalKey returns the key string for the underlying setting. func (s *MaskedSetting) InternalKey() InternalKey { return s.setting.InternalKey() diff --git a/pkg/settings/options.go b/pkg/settings/options.go index e030b93..750de4e 100644 --- a/pkg/settings/options.go +++ b/pkg/settings/options.go @@ -20,6 +20,7 @@ type SettingOption struct { validateFloat64Fn func(float64) error validateStringFn func(*Values, string) error validateProtoFn func(*Values, protoutil.Message) error + validateEnumFn func(string) error } // NameStatus indicates the status of a setting name. @@ -119,6 +120,11 @@ func WithValidateProto(fn func(*Values, protoutil.Message) error) SettingOption return SettingOption{validateProtoFn: fn} } +// WithValidateEnum adds a validation function for an enum setting. +func WithValidateEnum(fn func(string) error) SettingOption { + return SettingOption{validateEnumFn: fn} +} + func (c *common) apply(opts []SettingOption) { for _, opt := range opts { if opt.commonOpt != nil { diff --git a/pkg/settings/protobuf.go b/pkg/settings/protobuf.go index c38f572..2f1714d 100644 --- a/pkg/settings/protobuf.go +++ b/pkg/settings/protobuf.go @@ -109,6 +109,10 @@ func (s *ProtobufSetting) Validate(sv *Values, p protoutil.Message) error { return s.validateFn(sv, p) } +func (s *ProtobufSetting) IsSensitive() bool { + return s.sensitive +} + // Override sets the setting to the given value, assuming it passes validation. func (s *ProtobufSetting) Override(ctx context.Context, sv *Values, p protoutil.Message) { sv.setValueOrigin(ctx, s.slot, OriginOverride) diff --git a/pkg/settings/registry.go b/pkg/settings/registry.go index e6e2321..3db3f53 100644 --- a/pkg/settings/registry.go +++ b/pkg/settings/registry.go @@ -267,6 +267,25 @@ var retiredSettings = map[InternalKey]struct{}{ "changefeed.new_pubsub_sink_enabled": {}, "changefeed.new_pubsub_sink.enabled": {}, "logical_replication.consumer.use_implicit_txns.enabled": {}, + + // removed as of 25.3 + "sql.metrics.max_stmt_fingerprints_per_explicit_txn": {}, + "sql.jobs.legacy_per_job_access_via_details.enabled": {}, + + // removed as of 25.4 + "storage.columnar_blocks.enabled": {}, + + // removed as of 26.1 + "rocksdb.ingest_backpressure.l0_file_count_threshold": {}, + "rocksdb.ingest_backpressure.max_delay": {}, + "pebble.pre_ingest_delay.enabled": {}, + + // removed as of 26.2 + "bulkio.import.write_import_epoch.enabled": {}, + "physical_replication.consumer.stream_compression.enabled": {}, + "kvadmission.export_request_elastic_control.enabled": {}, + "changefeed.shutdown_checkpoint.enabled": {}, + "changefeed.aggregator.heartbeat": {}, } // grandfatheredDefaultSettings is the list of "grandfathered" existing sql.defaults @@ -487,7 +506,7 @@ func LookupForReportingByKey(key InternalKey, forSystemTenant bool) (Setting, bo if !forSystemTenant && s.Class() == SystemOnly { return nil, false } - if !s.isReportable() { + if !s.IsReportable() { return &MaskedSetting{setting: s}, true } return s, true @@ -524,7 +543,7 @@ func LookupForDisplayByKey( if !forSystemTenant && s.Class() == SystemOnly { return nil, false } - if s.isSensitive() && !canViewSensitive { + if s.IsSensitive() && !canViewSensitive { return &MaskedSetting{setting: s}, true } return s, true @@ -558,7 +577,7 @@ var ReadableTypes = map[string]string{ // - "" if there is no setting with this name. func RedactedValue(key InternalKey, values *Values, forSystemTenant bool) string { if k, ok := registry[key]; ok { - if k.Typ() == "s" || k.isSensitive() || !k.isReportable() { + if k.Typ() == "s" || k.IsSensitive() || !k.IsReportable() { return "" } } diff --git a/pkg/settings/setting.go b/pkg/settings/setting.go index 43763e4..15c2517 100644 --- a/pkg/settings/setting.go +++ b/pkg/settings/setting.go @@ -77,6 +77,10 @@ type Setting interface { // retrieving all settings. Visibility() Visibility + IsSensitive() bool + + IsReportable() bool + // IsUnsafe returns whether the setting is unsafe, and thus requires // a special interlock to set. IsUnsafe() bool diff --git a/pkg/settings/values.go b/pkg/settings/values.go index 59b681a..4e55bde 100644 --- a/pkg/settings/values.go +++ b/pkg/settings/values.go @@ -16,7 +16,7 @@ import ( // MaxSettings is the maximum number of settings that the system supports. // Exported for tests. -const MaxSettings = 1023 +const MaxSettings = 1151 // Values is a container that stores values for all registered settings. // Each setting is assigned a unique slot (up to MaxSettings). diff --git a/pkg/sql/colexec/execgen/cmd/execgen/cast_gen_util.go b/pkg/sql/colexec/execgen/cmd/execgen/cast_gen_util.go index 916e911..187089a 100644 --- a/pkg/sql/colexec/execgen/cmd/execgen/cast_gen_util.go +++ b/pkg/sql/colexec/execgen/cmd/execgen/cast_gen_util.go @@ -529,7 +529,7 @@ func toString(conv, to, toType string) string { // tree.AdjustValueToType. convStr := ` %[1]s - if %[3]s.Oid() != oid.T_name { + if %[3]s.Oid() != oid.T_name && %[3]s.Oid() != oid.T_aclitem { // bpchar types truncate trailing whitespace. if %[3]s.Oid() == oid.T_bpchar { %[2]s = bytes.TrimRight(%[2]s, " ") diff --git a/pkg/sql/colexec/execgen/cmd/execgen/default_cmp_proj_ops_gen.go b/pkg/sql/colexec/execgen/cmd/execgen/default_cmp_proj_ops_gen.go index f4e3155..a712d81 100644 --- a/pkg/sql/colexec/execgen/cmd/execgen/default_cmp_proj_ops_gen.go +++ b/pkg/sql/colexec/execgen/cmd/execgen/default_cmp_proj_ops_gen.go @@ -30,6 +30,7 @@ import ( "github.com/cockroachdb/cockroachdb-parser/pkg/sql/colexecerror" "github.com/cockroachdb/cockroachdb-parser/pkg/sql/colexecop" "github.com/cockroachdb/cockroachdb-parser/pkg/sql/execinfra/execreleasable" + "github.com/cockroachdb/cockroachdb-parser/pkg/sql/execinfrapb" "github.com/cockroachdb/cockroachdb-parser/pkg/sql/sem/tree" ) diff --git a/pkg/sql/colexec/execgen/cmd/execgen/distinct_gen.go b/pkg/sql/colexec/execgen/cmd/execgen/distinct_gen.go index c59a08d..705baee 100644 --- a/pkg/sql/colexec/execgen/cmd/execgen/distinct_gen.go +++ b/pkg/sql/colexec/execgen/cmd/execgen/distinct_gen.go @@ -38,6 +38,7 @@ import ( "github.com/cockroachdb/cockroachdb-parser/pkg/sql/colexec/execgen" "github.com/cockroachdb/cockroachdb-parser/pkg/sql/colexecop" "github.com/cockroachdb/cockroachdb-parser/pkg/sql/colexecerror" + "github.com/cockroachdb/cockroachdb-parser/pkg/sql/execinfrapb" "github.com/cockroachdb/cockroachdb-parser/pkg/sql/sem/tree" "github.com/cockroachdb/cockroachdb-parser/pkg/sql/types" "github.com/cockroachdb/cockroachdb-parser/pkg/util/duration" diff --git a/pkg/sql/colexec/execgen/cmd/execgen/like_ops_gen.go b/pkg/sql/colexec/execgen/cmd/execgen/like_ops_gen.go index f205881..e8f32ff 100644 --- a/pkg/sql/colexec/execgen/cmd/execgen/like_ops_gen.go +++ b/pkg/sql/colexec/execgen/cmd/execgen/like_ops_gen.go @@ -37,6 +37,7 @@ import ( "regexp" "github.com/cockroachdb/cockroachdb-parser/pkg/col/coldata" + "github.com/cockroachdb/cockroachdb-parser/pkg/sql/execinfrapb" ) {{range .}} diff --git a/pkg/sql/colexec/execgen/cmd/execgen/rowtovec_gen.go b/pkg/sql/colexec/execgen/cmd/execgen/rowtovec_gen.go index e37f5f7..5a923e2 100644 --- a/pkg/sql/colexec/execgen/cmd/execgen/rowtovec_gen.go +++ b/pkg/sql/colexec/execgen/cmd/execgen/rowtovec_gen.go @@ -69,10 +69,7 @@ type familyWidthPair struct { var rowToVecPreludeTmpls = map[familyWidthPair]string{ {types.StringFamily, anyWidth}: `// Handle other STRING-related OID types, like oid.T_name. - wrapper, ok := %[1]s.(*tree.DOidWrapper) - if ok { - %[1]s = wrapper.Wrapped - }`, + %[1]s = tree.UnwrapDOidWrapper(%[1]s)`, } // rowToVecConversionTmpls maps the type families to the corresponding diff --git a/pkg/sql/colexec/execgen/cmd/execgen/substring_gen.go b/pkg/sql/colexec/execgen/cmd/execgen/substring_gen.go index a0d0f88..0300b82 100644 --- a/pkg/sql/colexec/execgen/cmd/execgen/substring_gen.go +++ b/pkg/sql/colexec/execgen/cmd/execgen/substring_gen.go @@ -14,7 +14,7 @@ import ( "github.com/cockroachdb/cockroachdb-parser/pkg/sql/types" ) -const substringTmpl = "pkg/sql/colexec/substring_tmpl.go" +const substringTmpl = "pkg/sql/colexec/colexecbuiltins/substring_tmpl.go" func genSubstring(inputFileContents string, wr io.Writer) error { r := strings.NewReplacer( diff --git a/pkg/sql/colexec/execgen/cmd/execgen/vec_to_datum_gen.go b/pkg/sql/colexec/execgen/cmd/execgen/vec_to_datum_gen.go index d958073..509b01a 100644 --- a/pkg/sql/colexec/execgen/cmd/execgen/vec_to_datum_gen.go +++ b/pkg/sql/colexec/execgen/cmd/execgen/vec_to_datum_gen.go @@ -74,14 +74,15 @@ var vecToDatumConversionTmpls = map[types.Family]string{ %[1]s := %[3]s.NewDEncodedKey(tree.DEncodedKey(%[2]s))`, types.JsonFamily: ` // The following operation deliberately copies the input JSON - // bytes, since FromEncoding is lazy and keeps a handle on the bytes - // it is passed in. + // bytes, since FromEncodingInto is lazy and keeps a handle on the + // bytes it is passed in. _bytes, _err := json.EncodeJSON(nil, %[2]s) if _err != nil { colexecerror.ExpectedError(_err) } - var _j json.JSON - _j, _err = json.FromEncoding(_bytes) + _j := &jsonScratch[0] + jsonScratch = jsonScratch[1:] + _err = json.FromEncodingInto(_bytes, _j) if _err != nil { colexecerror.ExpectedError(_err) } diff --git a/pkg/sql/inverted/expression.go b/pkg/sql/inverted/expression.go index de562a4..bd191a4 100644 --- a/pkg/sql/inverted/expression.go +++ b/pkg/sql/inverted/expression.go @@ -682,8 +682,8 @@ func intersectSpanExpressions(left, right *SpanExpression) *SpanExpression { Right: right, } if expr.FactoredUnionSpans != nil { - left.FactoredUnionSpans = subtractSpans(left.FactoredUnionSpans, expr.FactoredUnionSpans) - right.FactoredUnionSpans = subtractSpans(right.FactoredUnionSpans, expr.FactoredUnionSpans) + left.FactoredUnionSpans = SubtractSpans(left.FactoredUnionSpans, expr.FactoredUnionSpans) + right.FactoredUnionSpans = SubtractSpans(right.FactoredUnionSpans, expr.FactoredUnionSpans) } tryPruneChildren(expr) return expr @@ -910,9 +910,9 @@ func intersectSpans(left []Span, right []Span) []Span { return spans } -// subtractSpans subtracts right from left, under the assumption that right is a +// SubtractSpans subtracts right from left, under the assumption that right is a // subset of left. -func subtractSpans(left []Span, right []Span) []Span { +func SubtractSpans(left []Span, right []Span) []Span { if len(right) == 0 { return left } diff --git a/pkg/sql/lexbase/allkeywords/main.go b/pkg/sql/lexbase/allkeywords/main.go index 927bda8..97c0462 100644 --- a/pkg/sql/lexbase/allkeywords/main.go +++ b/pkg/sql/lexbase/allkeywords/main.go @@ -107,18 +107,21 @@ var KeywordNames = []string{ {{end -}} } +var keywordID = map[string]int32{ +{{range . -}} + "{{.Keyword}}": {{.Ident}}, +{{end -}} +} + // GetKeywordID returns the lex id of the SQL keyword k or IDENT if k is // not a keyword. +// +//gcassert:inline func GetKeywordID(k string) int32 { - // The previous implementation generated a map that did a string -> - // id lookup. Various ideas were benchmarked and the implementation below - // was the fastest of those, between 3% and 10% faster (at parsing, so the - // scanning speedup is even more) than the map implementation. - switch k { - {{range . -}} - case "{{.Keyword}}": return {{.Ident}} - {{end -}} - default: return IDENT + id, ok := keywordID[k] + if !ok { + return IDENT } + return id } ` diff --git a/pkg/sql/lexbase/keywords.go b/pkg/sql/lexbase/keywords.go index fd6a768..89a3a6d 100644 --- a/pkg/sql/lexbase/keywords.go +++ b/pkg/sql/lexbase/keywords.go @@ -47,7 +47,6 @@ var KeywordsCategories = map[string]string{ "both": "R", "box2d": "C", "bucket_count": "U", -"bundle": "U", "by": "U", "bypassrls": "U", "cache": "U", @@ -60,6 +59,7 @@ var KeywordsCategories = map[string]string{ "cascade": "U", "case": "R", "cast": "R", +"chain": "U", "changefeed": "U", "char": "C", "character": "C", @@ -119,6 +119,7 @@ var KeywordsCategories = map[string]string{ "databases": "U", "day": "U", "deallocate": "U", +"debug": "U", "debug_ids": "U", "dec": "C", "decimal": "C", @@ -147,11 +148,11 @@ var KeywordsCategories = map[string]string{ "enable": "U", "encoding": "U", "encrypted": "U", -"encryption_info_dir": "U", "encryption_passphrase": "U", "end": "R", "enum": "U", "enums": "U", +"errors": "U", "escape": "U", "except": "R", "exclude": "U", @@ -166,6 +167,7 @@ var KeywordsCategories = map[string]string{ "experimental_replica": "U", "expiration": "U", "explain": "U", +"explicit": "U", "export": "U", "extension": "U", "external": "U", @@ -178,6 +180,7 @@ var KeywordsCategories = map[string]string{ "fetch": "R", "files": "U", "filter": "U", +"fingerprints": "U", "first": "U", "float": "C", "following": "U", @@ -220,6 +223,7 @@ var KeywordsCategories = map[string]string{ "having": "R", "header": "U", "high": "U", +"hints": "U", "histogram": "U", "hold": "U", "hour": "U", @@ -239,8 +243,6 @@ var KeywordsCategories = map[string]string{ "include_all_virtual_clusters": "U", "including": "U", "increment": "U", -"incremental": "U", -"incremental_location": "U", "index": "U", "indexes": "U", "index_after_order_by_before_at": "R", @@ -254,6 +256,7 @@ var KeywordsCategories = map[string]string{ "input": "U", "insensitive": "U", "insert": "U", +"inspect": "U", "instead": "U", "int": "C", "integer": "C", @@ -302,6 +305,7 @@ var KeywordsCategories = map[string]string{ "localtime": "R", "localtimestamp": "R", "locked": "U", +"logged": "U", "logical": "U", "logically": "U", "login": "U", @@ -316,7 +320,6 @@ var KeywordsCategories = map[string]string{ "minvalue": "U", "mode": "U", "modifyclustersetting": "U", -"modifysqlclustersetting": "U", "month": "U", "move": "U", "multilinestring": "U", @@ -336,6 +339,7 @@ var KeywordsCategories = map[string]string{ "natural": "T", "never": "U", "new": "U", +"newer": "U", "new_db_name": "U", "new_kms": "U", "next": "U", @@ -375,6 +379,7 @@ var KeywordsCategories = map[string]string{ "offset": "R", "oids": "U", "old": "U", +"older": "U", "old_kms": "U", "on": "R", "only": "R", @@ -430,8 +435,10 @@ var KeywordsCategories = map[string]string{ "privileges": "U", "procedure": "U", "procedures": "U", +"provisionsrc": "U", "public": "U", "publication": "U", +"push": "U", "queries": "U", "query": "U", "quote": "U", @@ -462,6 +469,7 @@ var KeywordsCategories = map[string]string{ "replicated": "U", "replication": "U", "reset": "U", +"resolved": "U", "restart": "U", "restore": "U", "restrict": "U", @@ -469,10 +477,10 @@ var KeywordsCategories = map[string]string{ "restrictive": "U", "resume": "U", "retention": "U", -"retry": "U", "return": "U", "returning": "R", "returns": "U", +"revision": "U", "revision_history": "U", "revoke": "U", "right": "T", @@ -484,6 +492,7 @@ var KeywordsCategories = map[string]string{ "row": "C", "rows": "U", "rule": "U", +"run": "U", "running": "U", "savepoint": "U", "scans": "U", @@ -499,6 +508,7 @@ var KeywordsCategories = map[string]string{ "second": "U", "secondary": "U", "security": "U", +"security_invoker": "U", "select": "R", "sequence": "U", "sequences": "U", @@ -572,6 +582,7 @@ var KeywordsCategories = map[string]string{ "tenant_name": "U", "testing_relocate": "U", "text": "U", +"than": "U", "then": "R", "throttling": "U", "ties": "U", @@ -629,9 +640,7 @@ var KeywordsCategories = map[string]string{ "view": "U", "viewactivity": "U", "viewactivityredacted": "U", -"viewclustermetadata": "U", "viewclustersetting": "U", -"viewdebug": "U", "virtual": "C", "virtual_cluster": "U", "virtual_cluster_name": "U", @@ -639,6 +648,7 @@ var KeywordsCategories = map[string]string{ "visible": "U", "volatile": "U", "voters": "U", +"watched_tables": "U", "when": "R", "where": "R", "window": "R", @@ -698,7 +708,6 @@ var KeywordNames = []string{ "both", "box2d", "bucket_count", -"bundle", "by", "bypassrls", "cache", @@ -711,6 +720,7 @@ var KeywordNames = []string{ "cascade", "case", "cast", +"chain", "changefeed", "char", "character", @@ -770,6 +780,7 @@ var KeywordNames = []string{ "databases", "day", "deallocate", +"debug", "debug_ids", "dec", "decimal", @@ -798,11 +809,11 @@ var KeywordNames = []string{ "enable", "encoding", "encrypted", -"encryption_info_dir", "encryption_passphrase", "end", "enum", "enums", +"errors", "escape", "except", "exclude", @@ -817,6 +828,7 @@ var KeywordNames = []string{ "experimental_replica", "expiration", "explain", +"explicit", "export", "extension", "external", @@ -829,6 +841,7 @@ var KeywordNames = []string{ "fetch", "files", "filter", +"fingerprints", "first", "float", "following", @@ -871,6 +884,7 @@ var KeywordNames = []string{ "having", "header", "high", +"hints", "histogram", "hold", "hour", @@ -890,8 +904,6 @@ var KeywordNames = []string{ "include_all_virtual_clusters", "including", "increment", -"incremental", -"incremental_location", "index", "indexes", "index_after_order_by_before_at", @@ -905,6 +917,7 @@ var KeywordNames = []string{ "input", "insensitive", "insert", +"inspect", "instead", "int", "integer", @@ -953,6 +966,7 @@ var KeywordNames = []string{ "localtime", "localtimestamp", "locked", +"logged", "logical", "logically", "login", @@ -967,7 +981,6 @@ var KeywordNames = []string{ "minvalue", "mode", "modifyclustersetting", -"modifysqlclustersetting", "month", "move", "multilinestring", @@ -987,6 +1000,7 @@ var KeywordNames = []string{ "natural", "never", "new", +"newer", "new_db_name", "new_kms", "next", @@ -1026,6 +1040,7 @@ var KeywordNames = []string{ "offset", "oids", "old", +"older", "old_kms", "on", "only", @@ -1081,8 +1096,10 @@ var KeywordNames = []string{ "privileges", "procedure", "procedures", +"provisionsrc", "public", "publication", +"push", "queries", "query", "quote", @@ -1113,6 +1130,7 @@ var KeywordNames = []string{ "replicated", "replication", "reset", +"resolved", "restart", "restore", "restrict", @@ -1120,10 +1138,10 @@ var KeywordNames = []string{ "restrictive", "resume", "retention", -"retry", "return", "returning", "returns", +"revision", "revision_history", "revoke", "right", @@ -1135,6 +1153,7 @@ var KeywordNames = []string{ "row", "rows", "rule", +"run", "running", "savepoint", "scans", @@ -1150,6 +1169,7 @@ var KeywordNames = []string{ "second", "secondary", "security", +"security_invoker", "select", "sequence", "sequences", @@ -1223,6 +1243,7 @@ var KeywordNames = []string{ "tenant_name", "testing_relocate", "text", +"than", "then", "throttling", "ties", @@ -1280,9 +1301,7 @@ var KeywordNames = []string{ "view", "viewactivity", "viewactivityredacted", -"viewclustermetadata", "viewclustersetting", -"viewdebug", "virtual", "virtual_cluster", "virtual_cluster_name", @@ -1290,6 +1309,7 @@ var KeywordNames = []string{ "visible", "volatile", "voters", +"watched_tables", "when", "where", "window", @@ -1302,660 +1322,673 @@ var KeywordNames = []string{ "zone", } +var keywordID = map[string]int32{ +"abort": ABORT, +"absolute": ABSOLUTE, +"access": ACCESS, +"action": ACTION, +"add": ADD, +"admin": ADMIN, +"after": AFTER, +"aggregate": AGGREGATE, +"all": ALL, +"alter": ALTER, +"always": ALWAYS, +"analyse": ANALYSE, +"analyze": ANALYZE, +"and": AND, +"annotate_type": ANNOTATE_TYPE, +"any": ANY, +"array": ARRAY, +"as": AS, +"asc": ASC, +"asensitive": ASENSITIVE, +"asymmetric": ASYMMETRIC, +"as_json": AS_JSON, +"at": AT, +"atomic": ATOMIC, +"attribute": ATTRIBUTE, +"authorization": AUTHORIZATION, +"automatic": AUTOMATIC, +"availability": AVAILABILITY, +"avoid_full_scan": AVOID_FULL_SCAN, +"backup": BACKUP, +"backups": BACKUPS, +"backward": BACKWARD, +"batch": BATCH, +"before": BEFORE, +"begin": BEGIN, +"between": BETWEEN, +"bidirectional": BIDIRECTIONAL, +"bigint": BIGINT, +"binary": BINARY, +"bit": BIT, +"boolean": BOOLEAN, +"both": BOTH, +"box2d": BOX2D, +"bucket_count": BUCKET_COUNT, +"by": BY, +"bypassrls": BYPASSRLS, +"cache": CACHE, +"call": CALL, +"called": CALLED, +"cancel": CANCEL, +"cancelquery": CANCELQUERY, +"capabilities": CAPABILITIES, +"capability": CAPABILITY, +"cascade": CASCADE, +"case": CASE, +"cast": CAST, +"chain": CHAIN, +"changefeed": CHANGEFEED, +"char": CHAR, +"character": CHARACTER, +"characteristics": CHARACTERISTICS, +"check": CHECK, +"check_files": CHECK_FILES, +"close": CLOSE, +"cluster": CLUSTER, +"clusters": CLUSTERS, +"coalesce": COALESCE, +"collate": COLLATE, +"collation": COLLATION, +"column": COLUMN, +"columns": COLUMNS, +"comment": COMMENT, +"comments": COMMENTS, +"commit": COMMIT, +"committed": COMMITTED, +"compact": COMPACT, +"complete": COMPLETE, +"completions": COMPLETIONS, +"concurrently": CONCURRENTLY, +"configuration": CONFIGURATION, +"configurations": CONFIGURATIONS, +"configure": CONFIGURE, +"conflict": CONFLICT, +"connection": CONNECTION, +"connections": CONNECTIONS, +"constraint": CONSTRAINT, +"constraints": CONSTRAINTS, +"controlchangefeed": CONTROLCHANGEFEED, +"controljob": CONTROLJOB, +"conversion": CONVERSION, +"convert": CONVERT, +"copy": COPY, +"cost": COST, +"covering": COVERING, +"create": CREATE, +"createdb": CREATEDB, +"createlogin": CREATELOGIN, +"createrole": CREATEROLE, +"cross": CROSS, +"csv": CSV, +"cube": CUBE, +"current": CURRENT, +"current_catalog": CURRENT_CATALOG, +"current_date": CURRENT_DATE, +"current_role": CURRENT_ROLE, +"current_schema": CURRENT_SCHEMA, +"current_time": CURRENT_TIME, +"current_timestamp": CURRENT_TIMESTAMP, +"current_user": CURRENT_USER, +"cursor": CURSOR, +"cycle": CYCLE, +"data": DATA, +"database": DATABASE, +"databases": DATABASES, +"day": DAY, +"deallocate": DEALLOCATE, +"debug": DEBUG, +"debug_ids": DEBUG_IDS, +"dec": DEC, +"decimal": DECIMAL, +"declare": DECLARE, +"default": DEFAULT, +"defaults": DEFAULTS, +"deferrable": DEFERRABLE, +"deferred": DEFERRED, +"definer": DEFINER, +"delete": DELETE, +"delimiter": DELIMITER, +"depends": DEPENDS, +"desc": DESC, +"destination": DESTINATION, +"detached": DETACHED, +"details": DETAILS, +"disable": DISABLE, +"discard": DISCARD, +"distinct": DISTINCT, +"do": DO, +"domain": DOMAIN, +"double": DOUBLE, +"drop": DROP, +"each": EACH, +"else": ELSE, +"enable": ENABLE, +"encoding": ENCODING, +"encrypted": ENCRYPTED, +"encryption_passphrase": ENCRYPTION_PASSPHRASE, +"end": END, +"enum": ENUM, +"enums": ENUMS, +"errors": ERRORS, +"escape": ESCAPE, +"except": EXCEPT, +"exclude": EXCLUDE, +"excluding": EXCLUDING, +"execute": EXECUTE, +"execution": EXECUTION, +"exists": EXISTS, +"experimental": EXPERIMENTAL, +"experimental_audit": EXPERIMENTAL_AUDIT, +"experimental_fingerprints": EXPERIMENTAL_FINGERPRINTS, +"experimental_relocate": EXPERIMENTAL_RELOCATE, +"experimental_replica": EXPERIMENTAL_REPLICA, +"expiration": EXPIRATION, +"explain": EXPLAIN, +"explicit": EXPLICIT, +"export": EXPORT, +"extension": EXTENSION, +"external": EXTERNAL, +"extract": EXTRACT, +"extract_duration": EXTRACT_DURATION, +"extremes": EXTREMES, +"failure": FAILURE, +"false": FALSE, +"family": FAMILY, +"fetch": FETCH, +"files": FILES, +"filter": FILTER, +"fingerprints": FINGERPRINTS, +"first": FIRST, +"float": FLOAT, +"following": FOLLOWING, +"for": FOR, +"force": FORCE, +"force_index": FORCE_INDEX, +"force_inverted_index": FORCE_INVERTED_INDEX, +"force_not_null": FORCE_NOT_NULL, +"force_null": FORCE_NULL, +"force_quote": FORCE_QUOTE, +"force_zigzag": FORCE_ZIGZAG, +"foreign": FOREIGN, +"format": FORMAT, +"forward": FORWARD, +"freeze": FREEZE, +"from": FROM, +"full": FULL, +"function": FUNCTION, +"functions": FUNCTIONS, +"generated": GENERATED, +"geography": GEOGRAPHY, +"geometry": GEOMETRY, +"geometrycollection": GEOMETRYCOLLECTION, +"geometrycollectionm": GEOMETRYCOLLECTIONM, +"geometrycollectionz": GEOMETRYCOLLECTIONZ, +"geometrycollectionzm": GEOMETRYCOLLECTIONZM, +"geometrym": GEOMETRYM, +"geometryz": GEOMETRYZ, +"geometryzm": GEOMETRYZM, +"global": GLOBAL, +"goal": GOAL, +"grant": GRANT, +"grantee": GRANTEE, +"grants": GRANTS, +"greatest": GREATEST, +"group": GROUP, +"grouping": GROUPING, +"groups": GROUPS, +"hash": HASH, +"having": HAVING, +"header": HEADER, +"high": HIGH, +"hints": HINTS, +"histogram": HISTOGRAM, +"hold": HOLD, +"hour": HOUR, +"identity": IDENTITY, +"if": IF, +"iferror": IFERROR, +"ifnull": IFNULL, +"ignore_foreign_keys": IGNORE_FOREIGN_KEYS, +"ilike": ILIKE, +"immediate": IMMEDIATE, +"immediately": IMMEDIATELY, +"immutable": IMMUTABLE, +"import": IMPORT, +"in": IN, +"include": INCLUDE, +"include_all_secondary_tenants": INCLUDE_ALL_SECONDARY_TENANTS, +"include_all_virtual_clusters": INCLUDE_ALL_VIRTUAL_CLUSTERS, +"including": INCLUDING, +"increment": INCREMENT, +"index": INDEX, +"indexes": INDEXES, +"index_after_order_by_before_at": INDEX_AFTER_ORDER_BY_BEFORE_AT, +"index_before_name_then_paren": INDEX_BEFORE_NAME_THEN_PAREN, +"index_before_paren": INDEX_BEFORE_PAREN, +"inherits": INHERITS, +"initially": INITIALLY, +"inject": INJECT, +"inner": INNER, +"inout": INOUT, +"input": INPUT, +"insensitive": INSENSITIVE, +"insert": INSERT, +"inspect": INSPECT, +"instead": INSTEAD, +"int": INT, +"integer": INTEGER, +"intersect": INTERSECT, +"interval": INTERVAL, +"into": INTO, +"into_db": INTO_DB, +"inverted": INVERTED, +"invisible": INVISIBLE, +"invoker": INVOKER, +"is": IS, +"iserror": ISERROR, +"isnull": ISNULL, +"isolation": ISOLATION, +"job": JOB, +"jobs": JOBS, +"join": JOIN, +"json": JSON, +"key": KEY, +"keys": KEYS, +"kms": KMS, +"kv": KV, +"label": LABEL, +"language": LANGUAGE, +"last": LAST, +"lateral": LATERAL, +"latest": LATEST, +"lc_collate": LC_COLLATE, +"lc_ctype": LC_CTYPE, +"leading": LEADING, +"leakproof": LEAKPROOF, +"lease": LEASE, +"least": LEAST, +"left": LEFT, +"less": LESS, +"level": LEVEL, +"like": LIKE, +"limit": LIMIT, +"linestring": LINESTRING, +"linestringm": LINESTRINGM, +"linestringz": LINESTRINGZ, +"linestringzm": LINESTRINGZM, +"list": LIST, +"local": LOCAL, +"locality": LOCALITY, +"localtime": LOCALTIME, +"localtimestamp": LOCALTIMESTAMP, +"locked": LOCKED, +"logged": LOGGED, +"logical": LOGICAL, +"logically": LOGICALLY, +"login": LOGIN, +"lookup": LOOKUP, +"low": LOW, +"match": MATCH, +"materialized": MATERIALIZED, +"maxvalue": MAXVALUE, +"merge": MERGE, +"method": METHOD, +"minute": MINUTE, +"minvalue": MINVALUE, +"mode": MODE, +"modifyclustersetting": MODIFYCLUSTERSETTING, +"month": MONTH, +"move": MOVE, +"multilinestring": MULTILINESTRING, +"multilinestringm": MULTILINESTRINGM, +"multilinestringz": MULTILINESTRINGZ, +"multilinestringzm": MULTILINESTRINGZM, +"multipoint": MULTIPOINT, +"multipointm": MULTIPOINTM, +"multipointz": MULTIPOINTZ, +"multipointzm": MULTIPOINTZM, +"multipolygon": MULTIPOLYGON, +"multipolygonm": MULTIPOLYGONM, +"multipolygonz": MULTIPOLYGONZ, +"multipolygonzm": MULTIPOLYGONZM, +"names": NAMES, +"nan": NAN, +"natural": NATURAL, +"never": NEVER, +"new": NEW, +"newer": NEWER, +"new_db_name": NEW_DB_NAME, +"new_kms": NEW_KMS, +"next": NEXT, +"no": NO, +"nobypassrls": NOBYPASSRLS, +"nocancelquery": NOCANCELQUERY, +"nocontrolchangefeed": NOCONTROLCHANGEFEED, +"nocontroljob": NOCONTROLJOB, +"nocreatedb": NOCREATEDB, +"nocreatelogin": NOCREATELOGIN, +"nocreaterole": NOCREATEROLE, +"node": NODE, +"nologin": NOLOGIN, +"nomodifyclustersetting": NOMODIFYCLUSTERSETTING, +"none": NONE, +"nonvoters": NONVOTERS, +"noreplication": NOREPLICATION, +"normal": NORMAL, +"nosqllogin": NOSQLLOGIN, +"not": NOT, +"nothing": NOTHING, +"nothing_after_returning": NOTHING_AFTER_RETURNING, +"notnull": NOTNULL, +"noviewactivity": NOVIEWACTIVITY, +"noviewactivityredacted": NOVIEWACTIVITYREDACTED, +"noviewclustersetting": NOVIEWCLUSTERSETTING, +"nowait": NOWAIT, +"no_full_scan": NO_FULL_SCAN, +"no_index_join": NO_INDEX_JOIN, +"no_zigzag_join": NO_ZIGZAG_JOIN, +"null": NULL, +"nullif": NULLIF, +"nulls": NULLS, +"numeric": NUMERIC, +"of": OF, +"off": OFF, +"offset": OFFSET, +"oids": OIDS, +"old": OLD, +"older": OLDER, +"old_kms": OLD_KMS, +"on": ON, +"only": ONLY, +"operator": OPERATOR, +"opt": OPT, +"option": OPTION, +"options": OPTIONS, +"or": OR, +"order": ORDER, +"ordinality": ORDINALITY, +"others": OTHERS, +"out": OUT, +"outer": OUTER, +"over": OVER, +"overlaps": OVERLAPS, +"overlay": OVERLAY, +"owned": OWNED, +"owner": OWNER, +"parallel": PARALLEL, +"parent": PARENT, +"partial": PARTIAL, +"partition": PARTITION, +"partitions": PARTITIONS, +"password": PASSWORD, +"pause": PAUSE, +"paused": PAUSED, +"per": PER, +"permissive": PERMISSIVE, +"physical": PHYSICAL, +"placement": PLACEMENT, +"placing": PLACING, +"plan": PLAN, +"plans": PLANS, +"point": POINT, +"pointm": POINTM, +"pointz": POINTZ, +"pointzm": POINTZM, +"policies": POLICIES, +"policy": POLICY, +"polygon": POLYGON, +"polygonm": POLYGONM, +"polygonz": POLYGONZ, +"polygonzm": POLYGONZM, +"position": POSITION, +"preceding": PRECEDING, +"precision": PRECISION, +"prepare": PREPARE, +"prepared": PREPARED, +"preserve": PRESERVE, +"primary": PRIMARY, +"prior": PRIOR, +"priority": PRIORITY, +"privileges": PRIVILEGES, +"procedure": PROCEDURE, +"procedures": PROCEDURES, +"provisionsrc": PROVISIONSRC, +"public": PUBLIC, +"publication": PUBLICATION, +"push": PUSH, +"queries": QUERIES, +"query": QUERY, +"quote": QUOTE, +"range": RANGE, +"ranges": RANGES, +"read": READ, +"real": REAL, +"reason": REASON, +"reassign": REASSIGN, +"recurring": RECURRING, +"recursive": RECURSIVE, +"redact": REDACT, +"ref": REF, +"references": REFERENCES, +"referencing": REFERENCING, +"refresh": REFRESH, +"region": REGION, +"regional": REGIONAL, +"regions": REGIONS, +"reindex": REINDEX, +"relative": RELATIVE, +"release": RELEASE, +"relocate": RELOCATE, +"remove_regions": REMOVE_REGIONS, +"rename": RENAME, +"repeatable": REPEATABLE, +"replace": REPLACE, +"replicated": REPLICATED, +"replication": REPLICATION, +"reset": RESET, +"resolved": RESOLVED, +"restart": RESTART, +"restore": RESTORE, +"restrict": RESTRICT, +"restricted": RESTRICTED, +"restrictive": RESTRICTIVE, +"resume": RESUME, +"retention": RETENTION, +"return": RETURN, +"returning": RETURNING, +"returns": RETURNS, +"revision": REVISION, +"revision_history": REVISION_HISTORY, +"revoke": REVOKE, +"right": RIGHT, +"role": ROLE, +"roles": ROLES, +"rollback": ROLLBACK, +"rollup": ROLLUP, +"routines": ROUTINES, +"row": ROW, +"rows": ROWS, +"rule": RULE, +"run": RUN, +"running": RUNNING, +"savepoint": SAVEPOINT, +"scans": SCANS, +"scatter": SCATTER, +"schedule": SCHEDULE, +"schedules": SCHEDULES, +"schema": SCHEMA, +"schemas": SCHEMAS, +"schema_only": SCHEMA_ONLY, +"scroll": SCROLL, +"scrub": SCRUB, +"search": SEARCH, +"second": SECOND, +"secondary": SECONDARY, +"security": SECURITY, +"security_invoker": SECURITY_INVOKER, +"select": SELECT, +"sequence": SEQUENCE, +"sequences": SEQUENCES, +"serializable": SERIALIZABLE, +"server": SERVER, +"service": SERVICE, +"session": SESSION, +"sessions": SESSIONS, +"session_user": SESSION_USER, +"set": SET, +"setof": SETOF, +"sets": SETS, +"setting": SETTING, +"settings": SETTINGS, +"share": SHARE, +"shared": SHARED, +"show": SHOW, +"similar": SIMILAR, +"simple": SIMPLE, +"size": SIZE, +"skip": SKIP, +"skip_localities_check": SKIP_LOCALITIES_CHECK, +"skip_missing_foreign_keys": SKIP_MISSING_FOREIGN_KEYS, +"skip_missing_sequences": SKIP_MISSING_SEQUENCES, +"skip_missing_sequence_owners": SKIP_MISSING_SEQUENCE_OWNERS, +"skip_missing_udfs": SKIP_MISSING_UDFS, +"skip_missing_views": SKIP_MISSING_VIEWS, +"smallint": SMALLINT, +"snapshot": SNAPSHOT, +"some": SOME, +"source": SOURCE, +"split": SPLIT, +"sql": SQL, +"sqllogin": SQLLOGIN, +"stable": STABLE, +"start": START, +"state": STATE, +"statement": STATEMENT, +"statements": STATEMENTS, +"statistics": STATISTICS, +"status": STATUS, +"stdin": STDIN, +"stdout": STDOUT, +"stop": STOP, +"storage": STORAGE, +"store": STORE, +"stored": STORED, +"storing": STORING, +"straight": STRAIGHT, +"stream": STREAM, +"strict": STRICT, +"string": STRING, +"subject": SUBJECT, +"subscription": SUBSCRIPTION, +"substring": SUBSTRING, +"super": SUPER, +"support": SUPPORT, +"survival": SURVIVAL, +"survive": SURVIVE, +"symmetric": SYMMETRIC, +"syntax": SYNTAX, +"system": SYSTEM, +"table": TABLE, +"tables": TABLES, +"tablespace": TABLESPACE, +"temp": TEMP, +"template": TEMPLATE, +"temporary": TEMPORARY, +"tenant": TENANT, +"tenants": TENANTS, +"tenant_name": TENANT_NAME, +"testing_relocate": TESTING_RELOCATE, +"text": TEXT, +"than": THAN, +"then": THEN, +"throttling": THROTTLING, +"ties": TIES, +"time": TIME, +"timestamp": TIMESTAMP, +"timestamptz": TIMESTAMPTZ, +"timetz": TIMETZ, +"to": TO, +"trace": TRACE, +"tracing": TRACING, +"trailing": TRAILING, +"transaction": TRANSACTION, +"transactions": TRANSACTIONS, +"transfer": TRANSFER, +"transform": TRANSFORM, +"treat": TREAT, +"trigger": TRIGGER, +"triggers": TRIGGERS, +"trim": TRIM, +"true": TRUE, +"truncate": TRUNCATE, +"trusted": TRUSTED, +"type": TYPE, +"types": TYPES, +"unbounded": UNBOUNDED, +"uncommitted": UNCOMMITTED, +"unidirectional": UNIDIRECTIONAL, +"union": UNION, +"unique": UNIQUE, +"unknown": UNKNOWN, +"unlisten": UNLISTEN, +"unlogged": UNLOGGED, +"unsafe_restore_incompatible_version": UNSAFE_RESTORE_INCOMPATIBLE_VERSION, +"unset": UNSET, +"unsplit": UNSPLIT, +"until": UNTIL, +"update": UPDATE, +"updates_cluster_monitoring_metrics": UPDATES_CLUSTER_MONITORING_METRICS, +"upsert": UPSERT, +"use": USE, +"user": USER, +"users": USERS, +"using": USING, +"valid": VALID, +"validate": VALIDATE, +"value": VALUE, +"values": VALUES, +"varbit": VARBIT, +"varchar": VARCHAR, +"variables": VARIABLES, +"variadic": VARIADIC, +"varying": VARYING, +"vector": VECTOR, +"verify_backup_table_data": VERIFY_BACKUP_TABLE_DATA, +"view": VIEW, +"viewactivity": VIEWACTIVITY, +"viewactivityredacted": VIEWACTIVITYREDACTED, +"viewclustersetting": VIEWCLUSTERSETTING, +"virtual": VIRTUAL, +"virtual_cluster": VIRTUAL_CLUSTER, +"virtual_cluster_name": VIRTUAL_CLUSTER_NAME, +"visibility": VISIBILITY, +"visible": VISIBLE, +"volatile": VOLATILE, +"voters": VOTERS, +"watched_tables": WATCHED_TABLES, +"when": WHEN, +"where": WHERE, +"window": WINDOW, +"with": WITH, +"within": WITHIN, +"without": WITHOUT, +"work": WORK, +"write": WRITE, +"year": YEAR, +"zone": ZONE, +} + // GetKeywordID returns the lex id of the SQL keyword k or IDENT if k is // not a keyword. +// +//gcassert:inline func GetKeywordID(k string) int32 { - // The previous implementation generated a map that did a string -> - // id lookup. Various ideas were benchmarked and the implementation below - // was the fastest of those, between 3% and 10% faster (at parsing, so the - // scanning speedup is even more) than the map implementation. - switch k { - case "abort": return ABORT - case "absolute": return ABSOLUTE - case "access": return ACCESS - case "action": return ACTION - case "add": return ADD - case "admin": return ADMIN - case "after": return AFTER - case "aggregate": return AGGREGATE - case "all": return ALL - case "alter": return ALTER - case "always": return ALWAYS - case "analyse": return ANALYSE - case "analyze": return ANALYZE - case "and": return AND - case "annotate_type": return ANNOTATE_TYPE - case "any": return ANY - case "array": return ARRAY - case "as": return AS - case "asc": return ASC - case "asensitive": return ASENSITIVE - case "asymmetric": return ASYMMETRIC - case "as_json": return AS_JSON - case "at": return AT - case "atomic": return ATOMIC - case "attribute": return ATTRIBUTE - case "authorization": return AUTHORIZATION - case "automatic": return AUTOMATIC - case "availability": return AVAILABILITY - case "avoid_full_scan": return AVOID_FULL_SCAN - case "backup": return BACKUP - case "backups": return BACKUPS - case "backward": return BACKWARD - case "batch": return BATCH - case "before": return BEFORE - case "begin": return BEGIN - case "between": return BETWEEN - case "bidirectional": return BIDIRECTIONAL - case "bigint": return BIGINT - case "binary": return BINARY - case "bit": return BIT - case "boolean": return BOOLEAN - case "both": return BOTH - case "box2d": return BOX2D - case "bucket_count": return BUCKET_COUNT - case "bundle": return BUNDLE - case "by": return BY - case "bypassrls": return BYPASSRLS - case "cache": return CACHE - case "call": return CALL - case "called": return CALLED - case "cancel": return CANCEL - case "cancelquery": return CANCELQUERY - case "capabilities": return CAPABILITIES - case "capability": return CAPABILITY - case "cascade": return CASCADE - case "case": return CASE - case "cast": return CAST - case "changefeed": return CHANGEFEED - case "char": return CHAR - case "character": return CHARACTER - case "characteristics": return CHARACTERISTICS - case "check": return CHECK - case "check_files": return CHECK_FILES - case "close": return CLOSE - case "cluster": return CLUSTER - case "clusters": return CLUSTERS - case "coalesce": return COALESCE - case "collate": return COLLATE - case "collation": return COLLATION - case "column": return COLUMN - case "columns": return COLUMNS - case "comment": return COMMENT - case "comments": return COMMENTS - case "commit": return COMMIT - case "committed": return COMMITTED - case "compact": return COMPACT - case "complete": return COMPLETE - case "completions": return COMPLETIONS - case "concurrently": return CONCURRENTLY - case "configuration": return CONFIGURATION - case "configurations": return CONFIGURATIONS - case "configure": return CONFIGURE - case "conflict": return CONFLICT - case "connection": return CONNECTION - case "connections": return CONNECTIONS - case "constraint": return CONSTRAINT - case "constraints": return CONSTRAINTS - case "controlchangefeed": return CONTROLCHANGEFEED - case "controljob": return CONTROLJOB - case "conversion": return CONVERSION - case "convert": return CONVERT - case "copy": return COPY - case "cost": return COST - case "covering": return COVERING - case "create": return CREATE - case "createdb": return CREATEDB - case "createlogin": return CREATELOGIN - case "createrole": return CREATEROLE - case "cross": return CROSS - case "csv": return CSV - case "cube": return CUBE - case "current": return CURRENT - case "current_catalog": return CURRENT_CATALOG - case "current_date": return CURRENT_DATE - case "current_role": return CURRENT_ROLE - case "current_schema": return CURRENT_SCHEMA - case "current_time": return CURRENT_TIME - case "current_timestamp": return CURRENT_TIMESTAMP - case "current_user": return CURRENT_USER - case "cursor": return CURSOR - case "cycle": return CYCLE - case "data": return DATA - case "database": return DATABASE - case "databases": return DATABASES - case "day": return DAY - case "deallocate": return DEALLOCATE - case "debug_ids": return DEBUG_IDS - case "dec": return DEC - case "decimal": return DECIMAL - case "declare": return DECLARE - case "default": return DEFAULT - case "defaults": return DEFAULTS - case "deferrable": return DEFERRABLE - case "deferred": return DEFERRED - case "definer": return DEFINER - case "delete": return DELETE - case "delimiter": return DELIMITER - case "depends": return DEPENDS - case "desc": return DESC - case "destination": return DESTINATION - case "detached": return DETACHED - case "details": return DETAILS - case "disable": return DISABLE - case "discard": return DISCARD - case "distinct": return DISTINCT - case "do": return DO - case "domain": return DOMAIN - case "double": return DOUBLE - case "drop": return DROP - case "each": return EACH - case "else": return ELSE - case "enable": return ENABLE - case "encoding": return ENCODING - case "encrypted": return ENCRYPTED - case "encryption_info_dir": return ENCRYPTION_INFO_DIR - case "encryption_passphrase": return ENCRYPTION_PASSPHRASE - case "end": return END - case "enum": return ENUM - case "enums": return ENUMS - case "escape": return ESCAPE - case "except": return EXCEPT - case "exclude": return EXCLUDE - case "excluding": return EXCLUDING - case "execute": return EXECUTE - case "execution": return EXECUTION - case "exists": return EXISTS - case "experimental": return EXPERIMENTAL - case "experimental_audit": return EXPERIMENTAL_AUDIT - case "experimental_fingerprints": return EXPERIMENTAL_FINGERPRINTS - case "experimental_relocate": return EXPERIMENTAL_RELOCATE - case "experimental_replica": return EXPERIMENTAL_REPLICA - case "expiration": return EXPIRATION - case "explain": return EXPLAIN - case "export": return EXPORT - case "extension": return EXTENSION - case "external": return EXTERNAL - case "extract": return EXTRACT - case "extract_duration": return EXTRACT_DURATION - case "extremes": return EXTREMES - case "failure": return FAILURE - case "false": return FALSE - case "family": return FAMILY - case "fetch": return FETCH - case "files": return FILES - case "filter": return FILTER - case "first": return FIRST - case "float": return FLOAT - case "following": return FOLLOWING - case "for": return FOR - case "force": return FORCE - case "force_index": return FORCE_INDEX - case "force_inverted_index": return FORCE_INVERTED_INDEX - case "force_not_null": return FORCE_NOT_NULL - case "force_null": return FORCE_NULL - case "force_quote": return FORCE_QUOTE - case "force_zigzag": return FORCE_ZIGZAG - case "foreign": return FOREIGN - case "format": return FORMAT - case "forward": return FORWARD - case "freeze": return FREEZE - case "from": return FROM - case "full": return FULL - case "function": return FUNCTION - case "functions": return FUNCTIONS - case "generated": return GENERATED - case "geography": return GEOGRAPHY - case "geometry": return GEOMETRY - case "geometrycollection": return GEOMETRYCOLLECTION - case "geometrycollectionm": return GEOMETRYCOLLECTIONM - case "geometrycollectionz": return GEOMETRYCOLLECTIONZ - case "geometrycollectionzm": return GEOMETRYCOLLECTIONZM - case "geometrym": return GEOMETRYM - case "geometryz": return GEOMETRYZ - case "geometryzm": return GEOMETRYZM - case "global": return GLOBAL - case "goal": return GOAL - case "grant": return GRANT - case "grantee": return GRANTEE - case "grants": return GRANTS - case "greatest": return GREATEST - case "group": return GROUP - case "grouping": return GROUPING - case "groups": return GROUPS - case "hash": return HASH - case "having": return HAVING - case "header": return HEADER - case "high": return HIGH - case "histogram": return HISTOGRAM - case "hold": return HOLD - case "hour": return HOUR - case "identity": return IDENTITY - case "if": return IF - case "iferror": return IFERROR - case "ifnull": return IFNULL - case "ignore_foreign_keys": return IGNORE_FOREIGN_KEYS - case "ilike": return ILIKE - case "immediate": return IMMEDIATE - case "immediately": return IMMEDIATELY - case "immutable": return IMMUTABLE - case "import": return IMPORT - case "in": return IN - case "include": return INCLUDE - case "include_all_secondary_tenants": return INCLUDE_ALL_SECONDARY_TENANTS - case "include_all_virtual_clusters": return INCLUDE_ALL_VIRTUAL_CLUSTERS - case "including": return INCLUDING - case "increment": return INCREMENT - case "incremental": return INCREMENTAL - case "incremental_location": return INCREMENTAL_LOCATION - case "index": return INDEX - case "indexes": return INDEXES - case "index_after_order_by_before_at": return INDEX_AFTER_ORDER_BY_BEFORE_AT - case "index_before_name_then_paren": return INDEX_BEFORE_NAME_THEN_PAREN - case "index_before_paren": return INDEX_BEFORE_PAREN - case "inherits": return INHERITS - case "initially": return INITIALLY - case "inject": return INJECT - case "inner": return INNER - case "inout": return INOUT - case "input": return INPUT - case "insensitive": return INSENSITIVE - case "insert": return INSERT - case "instead": return INSTEAD - case "int": return INT - case "integer": return INTEGER - case "intersect": return INTERSECT - case "interval": return INTERVAL - case "into": return INTO - case "into_db": return INTO_DB - case "inverted": return INVERTED - case "invisible": return INVISIBLE - case "invoker": return INVOKER - case "is": return IS - case "iserror": return ISERROR - case "isnull": return ISNULL - case "isolation": return ISOLATION - case "job": return JOB - case "jobs": return JOBS - case "join": return JOIN - case "json": return JSON - case "key": return KEY - case "keys": return KEYS - case "kms": return KMS - case "kv": return KV - case "label": return LABEL - case "language": return LANGUAGE - case "last": return LAST - case "lateral": return LATERAL - case "latest": return LATEST - case "lc_collate": return LC_COLLATE - case "lc_ctype": return LC_CTYPE - case "leading": return LEADING - case "leakproof": return LEAKPROOF - case "lease": return LEASE - case "least": return LEAST - case "left": return LEFT - case "less": return LESS - case "level": return LEVEL - case "like": return LIKE - case "limit": return LIMIT - case "linestring": return LINESTRING - case "linestringm": return LINESTRINGM - case "linestringz": return LINESTRINGZ - case "linestringzm": return LINESTRINGZM - case "list": return LIST - case "local": return LOCAL - case "locality": return LOCALITY - case "localtime": return LOCALTIME - case "localtimestamp": return LOCALTIMESTAMP - case "locked": return LOCKED - case "logical": return LOGICAL - case "logically": return LOGICALLY - case "login": return LOGIN - case "lookup": return LOOKUP - case "low": return LOW - case "match": return MATCH - case "materialized": return MATERIALIZED - case "maxvalue": return MAXVALUE - case "merge": return MERGE - case "method": return METHOD - case "minute": return MINUTE - case "minvalue": return MINVALUE - case "mode": return MODE - case "modifyclustersetting": return MODIFYCLUSTERSETTING - case "modifysqlclustersetting": return MODIFYSQLCLUSTERSETTING - case "month": return MONTH - case "move": return MOVE - case "multilinestring": return MULTILINESTRING - case "multilinestringm": return MULTILINESTRINGM - case "multilinestringz": return MULTILINESTRINGZ - case "multilinestringzm": return MULTILINESTRINGZM - case "multipoint": return MULTIPOINT - case "multipointm": return MULTIPOINTM - case "multipointz": return MULTIPOINTZ - case "multipointzm": return MULTIPOINTZM - case "multipolygon": return MULTIPOLYGON - case "multipolygonm": return MULTIPOLYGONM - case "multipolygonz": return MULTIPOLYGONZ - case "multipolygonzm": return MULTIPOLYGONZM - case "names": return NAMES - case "nan": return NAN - case "natural": return NATURAL - case "never": return NEVER - case "new": return NEW - case "new_db_name": return NEW_DB_NAME - case "new_kms": return NEW_KMS - case "next": return NEXT - case "no": return NO - case "nobypassrls": return NOBYPASSRLS - case "nocancelquery": return NOCANCELQUERY - case "nocontrolchangefeed": return NOCONTROLCHANGEFEED - case "nocontroljob": return NOCONTROLJOB - case "nocreatedb": return NOCREATEDB - case "nocreatelogin": return NOCREATELOGIN - case "nocreaterole": return NOCREATEROLE - case "node": return NODE - case "nologin": return NOLOGIN - case "nomodifyclustersetting": return NOMODIFYCLUSTERSETTING - case "none": return NONE - case "nonvoters": return NONVOTERS - case "noreplication": return NOREPLICATION - case "normal": return NORMAL - case "nosqllogin": return NOSQLLOGIN - case "not": return NOT - case "nothing": return NOTHING - case "nothing_after_returning": return NOTHING_AFTER_RETURNING - case "notnull": return NOTNULL - case "noviewactivity": return NOVIEWACTIVITY - case "noviewactivityredacted": return NOVIEWACTIVITYREDACTED - case "noviewclustersetting": return NOVIEWCLUSTERSETTING - case "nowait": return NOWAIT - case "no_full_scan": return NO_FULL_SCAN - case "no_index_join": return NO_INDEX_JOIN - case "no_zigzag_join": return NO_ZIGZAG_JOIN - case "null": return NULL - case "nullif": return NULLIF - case "nulls": return NULLS - case "numeric": return NUMERIC - case "of": return OF - case "off": return OFF - case "offset": return OFFSET - case "oids": return OIDS - case "old": return OLD - case "old_kms": return OLD_KMS - case "on": return ON - case "only": return ONLY - case "operator": return OPERATOR - case "opt": return OPT - case "option": return OPTION - case "options": return OPTIONS - case "or": return OR - case "order": return ORDER - case "ordinality": return ORDINALITY - case "others": return OTHERS - case "out": return OUT - case "outer": return OUTER - case "over": return OVER - case "overlaps": return OVERLAPS - case "overlay": return OVERLAY - case "owned": return OWNED - case "owner": return OWNER - case "parallel": return PARALLEL - case "parent": return PARENT - case "partial": return PARTIAL - case "partition": return PARTITION - case "partitions": return PARTITIONS - case "password": return PASSWORD - case "pause": return PAUSE - case "paused": return PAUSED - case "per": return PER - case "permissive": return PERMISSIVE - case "physical": return PHYSICAL - case "placement": return PLACEMENT - case "placing": return PLACING - case "plan": return PLAN - case "plans": return PLANS - case "point": return POINT - case "pointm": return POINTM - case "pointz": return POINTZ - case "pointzm": return POINTZM - case "policies": return POLICIES - case "policy": return POLICY - case "polygon": return POLYGON - case "polygonm": return POLYGONM - case "polygonz": return POLYGONZ - case "polygonzm": return POLYGONZM - case "position": return POSITION - case "preceding": return PRECEDING - case "precision": return PRECISION - case "prepare": return PREPARE - case "prepared": return PREPARED - case "preserve": return PRESERVE - case "primary": return PRIMARY - case "prior": return PRIOR - case "priority": return PRIORITY - case "privileges": return PRIVILEGES - case "procedure": return PROCEDURE - case "procedures": return PROCEDURES - case "public": return PUBLIC - case "publication": return PUBLICATION - case "queries": return QUERIES - case "query": return QUERY - case "quote": return QUOTE - case "range": return RANGE - case "ranges": return RANGES - case "read": return READ - case "real": return REAL - case "reason": return REASON - case "reassign": return REASSIGN - case "recurring": return RECURRING - case "recursive": return RECURSIVE - case "redact": return REDACT - case "ref": return REF - case "references": return REFERENCES - case "referencing": return REFERENCING - case "refresh": return REFRESH - case "region": return REGION - case "regional": return REGIONAL - case "regions": return REGIONS - case "reindex": return REINDEX - case "relative": return RELATIVE - case "release": return RELEASE - case "relocate": return RELOCATE - case "remove_regions": return REMOVE_REGIONS - case "rename": return RENAME - case "repeatable": return REPEATABLE - case "replace": return REPLACE - case "replicated": return REPLICATED - case "replication": return REPLICATION - case "reset": return RESET - case "restart": return RESTART - case "restore": return RESTORE - case "restrict": return RESTRICT - case "restricted": return RESTRICTED - case "restrictive": return RESTRICTIVE - case "resume": return RESUME - case "retention": return RETENTION - case "retry": return RETRY - case "return": return RETURN - case "returning": return RETURNING - case "returns": return RETURNS - case "revision_history": return REVISION_HISTORY - case "revoke": return REVOKE - case "right": return RIGHT - case "role": return ROLE - case "roles": return ROLES - case "rollback": return ROLLBACK - case "rollup": return ROLLUP - case "routines": return ROUTINES - case "row": return ROW - case "rows": return ROWS - case "rule": return RULE - case "running": return RUNNING - case "savepoint": return SAVEPOINT - case "scans": return SCANS - case "scatter": return SCATTER - case "schedule": return SCHEDULE - case "schedules": return SCHEDULES - case "schema": return SCHEMA - case "schemas": return SCHEMAS - case "schema_only": return SCHEMA_ONLY - case "scroll": return SCROLL - case "scrub": return SCRUB - case "search": return SEARCH - case "second": return SECOND - case "secondary": return SECONDARY - case "security": return SECURITY - case "select": return SELECT - case "sequence": return SEQUENCE - case "sequences": return SEQUENCES - case "serializable": return SERIALIZABLE - case "server": return SERVER - case "service": return SERVICE - case "session": return SESSION - case "sessions": return SESSIONS - case "session_user": return SESSION_USER - case "set": return SET - case "setof": return SETOF - case "sets": return SETS - case "setting": return SETTING - case "settings": return SETTINGS - case "share": return SHARE - case "shared": return SHARED - case "show": return SHOW - case "similar": return SIMILAR - case "simple": return SIMPLE - case "size": return SIZE - case "skip": return SKIP - case "skip_localities_check": return SKIP_LOCALITIES_CHECK - case "skip_missing_foreign_keys": return SKIP_MISSING_FOREIGN_KEYS - case "skip_missing_sequences": return SKIP_MISSING_SEQUENCES - case "skip_missing_sequence_owners": return SKIP_MISSING_SEQUENCE_OWNERS - case "skip_missing_udfs": return SKIP_MISSING_UDFS - case "skip_missing_views": return SKIP_MISSING_VIEWS - case "smallint": return SMALLINT - case "snapshot": return SNAPSHOT - case "some": return SOME - case "source": return SOURCE - case "split": return SPLIT - case "sql": return SQL - case "sqllogin": return SQLLOGIN - case "stable": return STABLE - case "start": return START - case "state": return STATE - case "statement": return STATEMENT - case "statements": return STATEMENTS - case "statistics": return STATISTICS - case "status": return STATUS - case "stdin": return STDIN - case "stdout": return STDOUT - case "stop": return STOP - case "storage": return STORAGE - case "store": return STORE - case "stored": return STORED - case "storing": return STORING - case "straight": return STRAIGHT - case "stream": return STREAM - case "strict": return STRICT - case "string": return STRING - case "subject": return SUBJECT - case "subscription": return SUBSCRIPTION - case "substring": return SUBSTRING - case "super": return SUPER - case "support": return SUPPORT - case "survival": return SURVIVAL - case "survive": return SURVIVE - case "symmetric": return SYMMETRIC - case "syntax": return SYNTAX - case "system": return SYSTEM - case "table": return TABLE - case "tables": return TABLES - case "tablespace": return TABLESPACE - case "temp": return TEMP - case "template": return TEMPLATE - case "temporary": return TEMPORARY - case "tenant": return TENANT - case "tenants": return TENANTS - case "tenant_name": return TENANT_NAME - case "testing_relocate": return TESTING_RELOCATE - case "text": return TEXT - case "then": return THEN - case "throttling": return THROTTLING - case "ties": return TIES - case "time": return TIME - case "timestamp": return TIMESTAMP - case "timestamptz": return TIMESTAMPTZ - case "timetz": return TIMETZ - case "to": return TO - case "trace": return TRACE - case "tracing": return TRACING - case "trailing": return TRAILING - case "transaction": return TRANSACTION - case "transactions": return TRANSACTIONS - case "transfer": return TRANSFER - case "transform": return TRANSFORM - case "treat": return TREAT - case "trigger": return TRIGGER - case "triggers": return TRIGGERS - case "trim": return TRIM - case "true": return TRUE - case "truncate": return TRUNCATE - case "trusted": return TRUSTED - case "type": return TYPE - case "types": return TYPES - case "unbounded": return UNBOUNDED - case "uncommitted": return UNCOMMITTED - case "unidirectional": return UNIDIRECTIONAL - case "union": return UNION - case "unique": return UNIQUE - case "unknown": return UNKNOWN - case "unlisten": return UNLISTEN - case "unlogged": return UNLOGGED - case "unsafe_restore_incompatible_version": return UNSAFE_RESTORE_INCOMPATIBLE_VERSION - case "unset": return UNSET - case "unsplit": return UNSPLIT - case "until": return UNTIL - case "update": return UPDATE - case "updates_cluster_monitoring_metrics": return UPDATES_CLUSTER_MONITORING_METRICS - case "upsert": return UPSERT - case "use": return USE - case "user": return USER - case "users": return USERS - case "using": return USING - case "valid": return VALID - case "validate": return VALIDATE - case "value": return VALUE - case "values": return VALUES - case "varbit": return VARBIT - case "varchar": return VARCHAR - case "variables": return VARIABLES - case "variadic": return VARIADIC - case "varying": return VARYING - case "vector": return VECTOR - case "verify_backup_table_data": return VERIFY_BACKUP_TABLE_DATA - case "view": return VIEW - case "viewactivity": return VIEWACTIVITY - case "viewactivityredacted": return VIEWACTIVITYREDACTED - case "viewclustermetadata": return VIEWCLUSTERMETADATA - case "viewclustersetting": return VIEWCLUSTERSETTING - case "viewdebug": return VIEWDEBUG - case "virtual": return VIRTUAL - case "virtual_cluster": return VIRTUAL_CLUSTER - case "virtual_cluster_name": return VIRTUAL_CLUSTER_NAME - case "visibility": return VISIBILITY - case "visible": return VISIBLE - case "volatile": return VOLATILE - case "voters": return VOTERS - case "when": return WHEN - case "where": return WHERE - case "window": return WINDOW - case "with": return WITH - case "within": return WITHIN - case "without": return WITHOUT - case "work": return WORK - case "write": return WRITE - case "year": return YEAR - case "zone": return ZONE - default: return IDENT + id, ok := keywordID[k] + if !ok { + return IDENT } + return id } diff --git a/pkg/sql/lexbase/predicates.go b/pkg/sql/lexbase/predicates.go index 5cbd442..f599f3e 100644 --- a/pkg/sql/lexbase/predicates.go +++ b/pkg/sql/lexbase/predicates.go @@ -32,6 +32,26 @@ func IsHexDigit(ch int) bool { (ch >= 'A' && ch <= 'F') } +var lookaheadKeywords = []string{ + "between", + "ilike", + "in", + "like", + "of", + "ordinality", + "similar", + "time", + "generated", + "reset", + "role", + "user", + "on", + "tenant", + "set", + "for", + "execute", +} + // reservedOrLookaheadKeywords are the reserved keywords plus those keywords for // which we need one token of lookahead extra to determine their token type. var reservedOrLookaheadKeywords = make(map[string]struct{}) @@ -40,23 +60,7 @@ func init() { for s := range reservedKeywords { reservedOrLookaheadKeywords[s] = struct{}{} } - for _, s := range []string{ - "between", - "ilike", - "in", - "like", - "of", - "ordinality", - "similar", - "time", - "generated", - "reset", - "role", - "user", - "on", - "tenant", - "set", - } { + for _, s := range lookaheadKeywords { reservedOrLookaheadKeywords[s] = struct{}{} } } diff --git a/pkg/sql/lexbase/tokens.go b/pkg/sql/lexbase/tokens.go index 6c01167..544fc94 100644 --- a/pkg/sql/lexbase/tokens.go +++ b/pkg/sql/lexbase/tokens.go @@ -67,20 +67,20 @@ const BUCKET_COUNT = 57406 const BOOLEAN = 57407 const BOTH = 57408 const BOX2D = 57409 -const BUNDLE = 57410 -const BY = 57411 -const BYPASSRLS = 57412 -const CACHE = 57413 -const CALL = 57414 -const CALLED = 57415 -const CANCEL = 57416 -const CANCELQUERY = 57417 -const CAPABILITIES = 57418 -const CAPABILITY = 57419 -const CASCADE = 57420 -const CASE = 57421 -const CAST = 57422 -const CBRT = 57423 +const BY = 57410 +const BYPASSRLS = 57411 +const CACHE = 57412 +const CALL = 57413 +const CALLED = 57414 +const CANCEL = 57415 +const CANCELQUERY = 57416 +const CAPABILITIES = 57417 +const CAPABILITY = 57418 +const CASCADE = 57419 +const CASE = 57420 +const CAST = 57421 +const CBRT = 57422 +const CHAIN = 57423 const CHANGEFEED = 57424 const CHAR = 57425 const CHARACTER = 57426 @@ -143,583 +143,600 @@ const DATABASE = 57482 const DATABASES = 57483 const DATE = 57484 const DAY = 57485 -const DEBUG_IDS = 57486 -const DEC = 57487 -const DECIMAL = 57488 -const DEFAULT = 57489 -const DEFAULTS = 57490 -const DEFINER = 57491 -const DEALLOCATE = 57492 -const DECLARE = 57493 -const DEFERRABLE = 57494 -const DEFERRED = 57495 -const DELETE = 57496 -const DELIMITER = 57497 -const DEPENDS = 57498 -const DESC = 57499 -const DESTINATION = 57500 -const DETACHED = 57501 -const DETAILS = 57502 -const DISABLE = 57503 -const DISCARD = 57504 -const DISTANCE = 57505 -const DISTINCT = 57506 -const DO = 57507 -const DOMAIN = 57508 -const DOUBLE = 57509 -const DROP = 57510 -const EACH = 57511 -const ELSE = 57512 -const ENABLE = 57513 -const ENCODING = 57514 -const ENCRYPTED = 57515 -const ENCRYPTION_INFO_DIR = 57516 +const DEBUG = 57486 +const DEBUG_IDS = 57487 +const DEC = 57488 +const DECIMAL = 57489 +const DEFAULT = 57490 +const DEFAULTS = 57491 +const DEFINER = 57492 +const DEALLOCATE = 57493 +const DECLARE = 57494 +const DEFERRABLE = 57495 +const DEFERRED = 57496 +const DELETE = 57497 +const DELIMITER = 57498 +const DEPENDS = 57499 +const DESC = 57500 +const DESTINATION = 57501 +const DETACHED = 57502 +const DETAILS = 57503 +const DISABLE = 57504 +const DISCARD = 57505 +const DISTANCE = 57506 +const DISTINCT = 57507 +const DO = 57508 +const DOMAIN = 57509 +const DOUBLE = 57510 +const DROP = 57511 +const EACH = 57512 +const ELSE = 57513 +const ENABLE = 57514 +const ENCODING = 57515 +const ENCRYPTED = 57516 const ENCRYPTION_PASSPHRASE = 57517 const END = 57518 const ENUM = 57519 const ENUMS = 57520 -const ESCAPE = 57521 -const EXCEPT = 57522 -const EXCLUDE = 57523 -const EXCLUDING = 57524 -const EXISTS = 57525 -const EXECUTE = 57526 -const EXECUTION = 57527 -const EXPERIMENTAL = 57528 -const EXPERIMENTAL_FINGERPRINTS = 57529 -const EXPERIMENTAL_REPLICA = 57530 -const EXPERIMENTAL_AUDIT = 57531 -const EXPERIMENTAL_RELOCATE = 57532 -const EXPIRATION = 57533 -const EXPLAIN = 57534 -const EXPORT = 57535 -const EXTENSION = 57536 -const EXTERNAL = 57537 -const EXTRACT = 57538 -const EXTRACT_DURATION = 57539 -const EXTREMES = 57540 -const FAILURE = 57541 -const FALSE = 57542 -const FAMILY = 57543 -const FETCH = 57544 -const FETCHVAL = 57545 -const FETCHTEXT = 57546 -const FETCHVAL_PATH = 57547 -const FETCHTEXT_PATH = 57548 -const FILES = 57549 -const FILTER = 57550 -const FIRST = 57551 -const FLOAT = 57552 -const FLOAT4 = 57553 -const FLOAT8 = 57554 -const FLOORDIV = 57555 -const FOLLOWING = 57556 -const FOR = 57557 -const FORCE = 57558 -const FORCE_INDEX = 57559 -const FORCE_INVERTED_INDEX = 57560 -const FORCE_NOT_NULL = 57561 -const FORCE_NULL = 57562 -const FORCE_QUOTE = 57563 -const FORCE_ZIGZAG = 57564 -const FOREIGN = 57565 -const FORMAT = 57566 -const FORWARD = 57567 -const FREEZE = 57568 -const FROM = 57569 -const FULL = 57570 -const FUNCTION = 57571 -const FUNCTIONS = 57572 -const GENERATED = 57573 -const GEOGRAPHY = 57574 -const GEOMETRY = 57575 -const GEOMETRYM = 57576 -const GEOMETRYZ = 57577 -const GEOMETRYZM = 57578 -const GEOMETRYCOLLECTION = 57579 -const GEOMETRYCOLLECTIONM = 57580 -const GEOMETRYCOLLECTIONZ = 57581 -const GEOMETRYCOLLECTIONZM = 57582 -const GLOBAL = 57583 -const GOAL = 57584 -const GRANT = 57585 -const GRANTEE = 57586 -const GRANTS = 57587 -const GREATEST = 57588 -const GROUP = 57589 -const GROUPING = 57590 -const GROUPS = 57591 -const HAVING = 57592 -const HASH = 57593 -const HEADER = 57594 -const HIGH = 57595 -const HISTOGRAM = 57596 -const HOLD = 57597 -const HOUR = 57598 -const IDENTITY = 57599 -const IF = 57600 -const IFERROR = 57601 -const IFNULL = 57602 -const IGNORE_FOREIGN_KEYS = 57603 -const ILIKE = 57604 -const IMMEDIATE = 57605 -const IMMEDIATELY = 57606 -const IMMUTABLE = 57607 -const IMPORT = 57608 -const IN = 57609 -const INCLUDE = 57610 -const INCLUDING = 57611 -const INCLUDE_ALL_SECONDARY_TENANTS = 57612 -const INCLUDE_ALL_VIRTUAL_CLUSTERS = 57613 -const INCREMENT = 57614 -const INCREMENTAL = 57615 -const INCREMENTAL_LOCATION = 57616 -const INET = 57617 -const INET_CONTAINED_BY_OR_EQUALS = 57618 -const INET_CONTAINS_OR_EQUALS = 57619 -const INDEX = 57620 -const INDEXES = 57621 -const INHERITS = 57622 -const INJECT = 57623 -const INITIALLY = 57624 -const INDEX_BEFORE_PAREN = 57625 -const INDEX_BEFORE_NAME_THEN_PAREN = 57626 -const INDEX_AFTER_ORDER_BY_BEFORE_AT = 57627 -const INNER = 57628 -const INOUT = 57629 -const INPUT = 57630 -const INSENSITIVE = 57631 -const INSERT = 57632 -const INSTEAD = 57633 -const INT = 57634 -const INTEGER = 57635 -const INTERSECT = 57636 -const INTERVAL = 57637 -const INTO = 57638 -const INTO_DB = 57639 -const INVERTED = 57640 -const INVOKER = 57641 -const IS = 57642 -const ISERROR = 57643 -const ISNULL = 57644 -const ISOLATION = 57645 -const JOB = 57646 -const JOBS = 57647 -const JOIN = 57648 -const JSON = 57649 -const JSONB = 57650 -const JSON_SOME_EXISTS = 57651 -const JSON_ALL_EXISTS = 57652 -const KEY = 57653 -const KEYS = 57654 -const KMS = 57655 -const KV = 57656 -const LABEL = 57657 -const LANGUAGE = 57658 -const LAST = 57659 -const LATERAL = 57660 -const LATEST = 57661 -const LC_CTYPE = 57662 -const LC_COLLATE = 57663 -const LEADING = 57664 -const LEASE = 57665 -const LEAST = 57666 -const LEAKPROOF = 57667 -const LEFT = 57668 -const LESS = 57669 -const LEVEL = 57670 -const LIKE = 57671 -const LIMIT = 57672 -const LINESTRING = 57673 -const LINESTRINGM = 57674 -const LINESTRINGZ = 57675 -const LINESTRINGZM = 57676 -const LIST = 57677 -const LOCAL = 57678 -const LOCALITY = 57679 -const LOCALTIME = 57680 -const LOCALTIMESTAMP = 57681 -const LOCKED = 57682 -const LOGICAL = 57683 -const LOGICALLY = 57684 -const LOGIN = 57685 -const LOOKUP = 57686 -const LOW = 57687 -const LSHIFT = 57688 -const MATCH = 57689 -const MATERIALIZED = 57690 -const MERGE = 57691 -const MINVALUE = 57692 -const MAXVALUE = 57693 -const METHOD = 57694 -const MINUTE = 57695 -const MODIFYCLUSTERSETTING = 57696 -const MODIFYSQLCLUSTERSETTING = 57697 -const MODE = 57698 -const MONTH = 57699 -const MOVE = 57700 -const MULTILINESTRING = 57701 -const MULTILINESTRINGM = 57702 -const MULTILINESTRINGZ = 57703 -const MULTILINESTRINGZM = 57704 -const MULTIPOINT = 57705 -const MULTIPOINTM = 57706 -const MULTIPOINTZ = 57707 -const MULTIPOINTZM = 57708 -const MULTIPOLYGON = 57709 -const MULTIPOLYGONM = 57710 -const MULTIPOLYGONZ = 57711 -const MULTIPOLYGONZM = 57712 -const NAN = 57713 -const NAME = 57714 -const NAMES = 57715 -const NATURAL = 57716 -const NEG_INNER_PRODUCT = 57717 -const NEVER = 57718 -const NEW = 57719 -const NEW_DB_NAME = 57720 -const NEW_KMS = 57721 -const NEXT = 57722 -const NO = 57723 -const NOBYPASSRLS = 57724 -const NOCANCELQUERY = 57725 -const NOCONTROLCHANGEFEED = 57726 -const NOCONTROLJOB = 57727 -const NOCREATEDB = 57728 -const NOCREATELOGIN = 57729 -const NOCREATEROLE = 57730 -const NODE = 57731 -const NOLOGIN = 57732 -const NOMODIFYCLUSTERSETTING = 57733 -const NOREPLICATION = 57734 -const NOSQLLOGIN = 57735 -const NO_INDEX_JOIN = 57736 -const NO_ZIGZAG_JOIN = 57737 -const NO_FULL_SCAN = 57738 -const NONE = 57739 -const NONVOTERS = 57740 -const NORMAL = 57741 -const NOT = 57742 -const NOTHING = 57743 -const NOTHING_AFTER_RETURNING = 57744 -const NOTNULL = 57745 -const NOVIEWACTIVITY = 57746 -const NOVIEWACTIVITYREDACTED = 57747 -const NOVIEWCLUSTERSETTING = 57748 -const NOWAIT = 57749 -const NULL = 57750 -const NULLIF = 57751 -const NULLS = 57752 -const NUMERIC = 57753 -const OF = 57754 -const OFF = 57755 -const OFFSET = 57756 -const OID = 57757 -const OIDS = 57758 -const OIDVECTOR = 57759 -const OLD = 57760 -const OLD_KMS = 57761 -const ON = 57762 -const ONLY = 57763 -const OPT = 57764 -const OPTION = 57765 -const OPTIONS = 57766 -const OR = 57767 -const ORDER = 57768 -const ORDINALITY = 57769 -const OTHERS = 57770 -const OUT = 57771 -const OUTER = 57772 -const OVER = 57773 -const OVERLAPS = 57774 -const OVERLAY = 57775 -const OWNED = 57776 -const OWNER = 57777 -const OPERATOR = 57778 -const PARALLEL = 57779 -const PARENT = 57780 -const PARTIAL = 57781 -const PARTITION = 57782 -const PARTITIONS = 57783 -const PASSWORD = 57784 -const PAUSE = 57785 -const PAUSED = 57786 -const PER = 57787 -const PERMISSIVE = 57788 -const PHYSICAL = 57789 -const PLACEMENT = 57790 -const PLACING = 57791 -const PLAN = 57792 -const PLANS = 57793 -const POINT = 57794 -const POINTM = 57795 -const POINTZ = 57796 -const POINTZM = 57797 -const POLICIES = 57798 -const POLICY = 57799 -const POLYGON = 57800 -const POLYGONM = 57801 -const POLYGONZ = 57802 -const POLYGONZM = 57803 -const POSITION = 57804 -const PRECEDING = 57805 -const PRECISION = 57806 -const PREPARE = 57807 -const PREPARED = 57808 -const PRESERVE = 57809 -const PRIMARY = 57810 -const PRIOR = 57811 -const PRIORITY = 57812 -const PRIVILEGES = 57813 -const PROCEDURAL = 57814 -const PROCEDURE = 57815 -const PROCEDURES = 57816 -const PUBLIC = 57817 -const PUBLICATION = 57818 -const QUERIES = 57819 -const QUERY = 57820 -const QUOTE = 57821 -const RANGE = 57822 -const RANGES = 57823 -const READ = 57824 -const REAL = 57825 -const REASON = 57826 -const REASSIGN = 57827 -const RECURSIVE = 57828 -const RECURRING = 57829 -const REDACT = 57830 -const REF = 57831 -const REFERENCES = 57832 -const REFERENCING = 57833 -const REFRESH = 57834 -const REGCLASS = 57835 -const REGION = 57836 -const REGIONAL = 57837 -const REGIONS = 57838 -const REGNAMESPACE = 57839 -const REGPROC = 57840 -const REGPROCEDURE = 57841 -const REGROLE = 57842 -const REGTYPE = 57843 -const REINDEX = 57844 -const RELATIVE = 57845 -const RELOCATE = 57846 -const REMOVE_PATH = 57847 -const REMOVE_REGIONS = 57848 -const RENAME = 57849 -const REPEATABLE = 57850 -const REPLACE = 57851 -const REPLICATED = 57852 -const REPLICATION = 57853 -const RELEASE = 57854 -const RESET = 57855 -const RESTART = 57856 -const RESTORE = 57857 -const RESTRICT = 57858 -const RESTRICTED = 57859 -const RESTRICTIVE = 57860 -const RESUME = 57861 -const RETENTION = 57862 -const RETURNING = 57863 -const RETURN = 57864 -const RETURNS = 57865 -const RETRY = 57866 -const REVISION_HISTORY = 57867 -const REVOKE = 57868 -const RIGHT = 57869 -const ROLE = 57870 -const ROLES = 57871 -const ROLLBACK = 57872 -const ROLLUP = 57873 -const ROUTINES = 57874 -const ROW = 57875 -const ROWS = 57876 -const RSHIFT = 57877 -const RULE = 57878 -const RUNNING = 57879 -const SAVEPOINT = 57880 -const SCANS = 57881 -const SCATTER = 57882 -const SCHEDULE = 57883 -const SCHEDULES = 57884 -const SCROLL = 57885 -const SCHEMA = 57886 -const SCHEMA_ONLY = 57887 -const SCHEMAS = 57888 -const SCRUB = 57889 -const SEARCH = 57890 -const SECOND = 57891 -const SECONDARY = 57892 -const SECURITY = 57893 -const SELECT = 57894 -const SEQUENCE = 57895 -const SEQUENCES = 57896 -const SERIALIZABLE = 57897 -const SERVER = 57898 -const SERVICE = 57899 -const SESSION = 57900 -const SESSIONS = 57901 -const SESSION_USER = 57902 -const SET = 57903 -const SETOF = 57904 -const SETS = 57905 -const SETTING = 57906 -const SETTINGS = 57907 -const SHARE = 57908 -const SHARED = 57909 -const SHOW = 57910 -const SIMILAR = 57911 -const SIMPLE = 57912 -const SIZE = 57913 -const SKIP = 57914 -const SKIP_LOCALITIES_CHECK = 57915 -const SKIP_MISSING_FOREIGN_KEYS = 57916 -const SKIP_MISSING_SEQUENCES = 57917 -const SKIP_MISSING_SEQUENCE_OWNERS = 57918 -const SKIP_MISSING_VIEWS = 57919 -const SKIP_MISSING_UDFS = 57920 -const SMALLINT = 57921 -const SMALLSERIAL = 57922 -const SNAPSHOT = 57923 -const SOME = 57924 -const SOURCE = 57925 -const SPLIT = 57926 -const SQL = 57927 -const SQLLOGIN = 57928 -const STABLE = 57929 -const START = 57930 -const STATE = 57931 -const STATEMENT = 57932 -const STATISTICS = 57933 -const STATUS = 57934 -const STDIN = 57935 -const STDOUT = 57936 -const STOP = 57937 -const STRAIGHT = 57938 -const STREAM = 57939 -const STRICT = 57940 -const STRING = 57941 -const STORAGE = 57942 -const STORE = 57943 -const STORED = 57944 -const STORING = 57945 -const SUBJECT = 57946 -const SUBSTRING = 57947 -const SUPER = 57948 -const SUPPORT = 57949 -const SURVIVE = 57950 -const SURVIVAL = 57951 -const SYMMETRIC = 57952 -const SYNTAX = 57953 -const SYSTEM = 57954 -const SQRT = 57955 -const SUBSCRIPTION = 57956 -const STATEMENTS = 57957 -const TABLE = 57958 -const TABLES = 57959 -const TABLESPACE = 57960 -const TEMP = 57961 -const TEMPLATE = 57962 -const TEMPORARY = 57963 -const TENANT = 57964 -const TENANT_NAME = 57965 -const TENANTS = 57966 -const TESTING_RELOCATE = 57967 -const TEXT = 57968 -const THEN = 57969 -const TIES = 57970 -const TIME = 57971 -const TIMETZ = 57972 -const TIMESTAMP = 57973 -const TIMESTAMPTZ = 57974 -const TO = 57975 -const THROTTLING = 57976 -const TRAILING = 57977 -const TRACE = 57978 -const TRANSACTION = 57979 -const TRANSACTIONS = 57980 -const TRANSFER = 57981 -const TRANSFORM = 57982 -const TREAT = 57983 -const TRIGGER = 57984 -const TRIGGERS = 57985 -const TRIM = 57986 -const TRUE = 57987 -const TRUNCATE = 57988 -const TRUSTED = 57989 -const TYPE = 57990 -const TYPES = 57991 -const TRACING = 57992 -const UNBOUNDED = 57993 -const UNCOMMITTED = 57994 -const UNIDIRECTIONAL = 57995 -const UNION = 57996 -const UNIQUE = 57997 -const UNKNOWN = 57998 -const UNLISTEN = 57999 -const UNLOGGED = 58000 -const UNSAFE_RESTORE_INCOMPATIBLE_VERSION = 58001 -const UNSPLIT = 58002 -const UPDATE = 58003 -const UPDATES_CLUSTER_MONITORING_METRICS = 58004 -const UPSERT = 58005 -const UNSET = 58006 -const UNTIL = 58007 -const USE = 58008 -const USER = 58009 -const USERS = 58010 -const USING = 58011 -const UUID = 58012 -const VALID = 58013 -const VALIDATE = 58014 -const VALUE = 58015 -const VALUES = 58016 -const VARBIT = 58017 -const VARCHAR = 58018 -const VARIADIC = 58019 -const VECTOR = 58020 -const VERIFY_BACKUP_TABLE_DATA = 58021 -const VIEW = 58022 -const VARIABLES = 58023 -const VARYING = 58024 -const VIEWACTIVITY = 58025 -const VIEWACTIVITYREDACTED = 58026 -const VIEWDEBUG = 58027 -const VIEWCLUSTERMETADATA = 58028 -const VIEWCLUSTERSETTING = 58029 -const VIRTUAL = 58030 -const VISIBLE = 58031 -const INVISIBLE = 58032 -const VISIBILITY = 58033 -const VOLATILE = 58034 -const VOTERS = 58035 -const VIRTUAL_CLUSTER_NAME = 58036 -const VIRTUAL_CLUSTER = 58037 -const WHEN = 58038 -const WHERE = 58039 -const WINDOW = 58040 -const WITH = 58041 -const WITHIN = 58042 -const WITHOUT = 58043 -const WORK = 58044 -const WRITE = 58045 -const YEAR = 58046 -const ZONE = 58047 -const NOT_LA = 58048 -const NULLS_LA = 58049 -const WITH_LA = 58050 -const AS_LA = 58051 -const GENERATED_ALWAYS = 58052 -const GENERATED_BY_DEFAULT = 58053 -const RESET_ALL = 58054 -const ROLE_ALL = 58055 -const USER_ALL = 58056 -const ON_LA = 58057 -const TENANT_ALL = 58058 -const CLUSTER_ALL = 58059 -const SET_TRACING = 58060 -const CONTAINED_BY = 58061 -const POSTFIXOP = 58062 -const INTERVAL_SIMPLE = 58063 -const UMINUS = 58064 -const HELPTOKEN = 58065 +const ERRORS = 57521 +const ESCAPE = 57522 +const EXCEPT = 57523 +const EXCLUDE = 57524 +const EXCLUDING = 57525 +const EXPLICIT = 57526 +const EXISTS = 57527 +const EXECUTE = 57528 +const EXECUTION = 57529 +const EXPERIMENTAL = 57530 +const EXPERIMENTAL_FINGERPRINTS = 57531 +const EXPERIMENTAL_REPLICA = 57532 +const EXPERIMENTAL_AUDIT = 57533 +const EXPERIMENTAL_RELOCATE = 57534 +const EXPIRATION = 57535 +const EXPLAIN = 57536 +const EXPORT = 57537 +const EXTENSION = 57538 +const EXTERNAL = 57539 +const EXTRACT = 57540 +const EXTRACT_DURATION = 57541 +const EXTREMES = 57542 +const FAILURE = 57543 +const FALSE = 57544 +const FAMILY = 57545 +const FETCH = 57546 +const FETCHVAL = 57547 +const FETCHTEXT = 57548 +const FETCHVAL_PATH = 57549 +const FETCHTEXT_PATH = 57550 +const FILES = 57551 +const FILTER = 57552 +const FINGERPRINTS = 57553 +const FIRST = 57554 +const FIRST_CONTAINED_BY = 57555 +const FIRST_CONTAINS = 57556 +const FLOAT = 57557 +const FLOAT4 = 57558 +const FLOAT8 = 57559 +const FLOORDIV = 57560 +const FOLLOWING = 57561 +const FOR = 57562 +const FORCE = 57563 +const FORCE_INDEX = 57564 +const FORCE_INVERTED_INDEX = 57565 +const FORCE_NOT_NULL = 57566 +const FORCE_NULL = 57567 +const FORCE_QUOTE = 57568 +const FORCE_ZIGZAG = 57569 +const FOREIGN = 57570 +const FORMAT = 57571 +const FORWARD = 57572 +const FREEZE = 57573 +const FROM = 57574 +const FULL = 57575 +const FUNCTION = 57576 +const FUNCTIONS = 57577 +const GENERATED = 57578 +const GEOGRAPHY = 57579 +const GEOMETRY = 57580 +const GEOMETRYM = 57581 +const GEOMETRYZ = 57582 +const GEOMETRYZM = 57583 +const GEOMETRYCOLLECTION = 57584 +const GEOMETRYCOLLECTIONM = 57585 +const GEOMETRYCOLLECTIONZ = 57586 +const GEOMETRYCOLLECTIONZM = 57587 +const GLOBAL = 57588 +const GOAL = 57589 +const GRANT = 57590 +const GRANTEE = 57591 +const GRANTS = 57592 +const GREATEST = 57593 +const GROUP = 57594 +const GROUPING = 57595 +const GROUPS = 57596 +const HAVING = 57597 +const HASH = 57598 +const HEADER = 57599 +const HIGH = 57600 +const HINTS = 57601 +const HISTOGRAM = 57602 +const HOLD = 57603 +const HOUR = 57604 +const IDENTITY = 57605 +const IF = 57606 +const IFERROR = 57607 +const IFNULL = 57608 +const IGNORE_FOREIGN_KEYS = 57609 +const ILIKE = 57610 +const IMMEDIATE = 57611 +const IMMEDIATELY = 57612 +const IMMUTABLE = 57613 +const IMPORT = 57614 +const IN = 57615 +const INCLUDE = 57616 +const INCLUDING = 57617 +const INCLUDE_ALL_SECONDARY_TENANTS = 57618 +const INCLUDE_ALL_VIRTUAL_CLUSTERS = 57619 +const INCREMENT = 57620 +const INET = 57621 +const INET_CONTAINED_BY_OR_EQUALS = 57622 +const INET_CONTAINS_OR_EQUALS = 57623 +const INDEX = 57624 +const INDEXES = 57625 +const INHERITS = 57626 +const INJECT = 57627 +const INITIALLY = 57628 +const INDEX_BEFORE_PAREN = 57629 +const INDEX_BEFORE_NAME_THEN_PAREN = 57630 +const INDEX_AFTER_ORDER_BY_BEFORE_AT = 57631 +const INNER = 57632 +const INOUT = 57633 +const INPUT = 57634 +const INSENSITIVE = 57635 +const INSERT = 57636 +const INSPECT = 57637 +const INSTEAD = 57638 +const INT = 57639 +const INTEGER = 57640 +const INTERSECT = 57641 +const INTERVAL = 57642 +const INTO = 57643 +const INTO_DB = 57644 +const INVERTED = 57645 +const INVOKER = 57646 +const IS = 57647 +const ISERROR = 57648 +const ISNULL = 57649 +const ISOLATION = 57650 +const JOB = 57651 +const JOBS = 57652 +const JOIN = 57653 +const JSON = 57654 +const JSONB = 57655 +const JSON_SOME_EXISTS = 57656 +const JSON_ALL_EXISTS = 57657 +const KEY = 57658 +const KEYS = 57659 +const KMS = 57660 +const KV = 57661 +const LABEL = 57662 +const LANGUAGE = 57663 +const LAST = 57664 +const LATERAL = 57665 +const LATEST = 57666 +const LC_CTYPE = 57667 +const LC_COLLATE = 57668 +const LEADING = 57669 +const LEASE = 57670 +const LEAST = 57671 +const LEAKPROOF = 57672 +const LEFT = 57673 +const LESS = 57674 +const LEVEL = 57675 +const LIKE = 57676 +const LIMIT = 57677 +const LINESTRING = 57678 +const LINESTRINGM = 57679 +const LINESTRINGZ = 57680 +const LINESTRINGZM = 57681 +const LIST = 57682 +const LOCAL = 57683 +const LOCALITY = 57684 +const LOCALTIME = 57685 +const LOCALTIMESTAMP = 57686 +const LOCKED = 57687 +const LOGGED = 57688 +const LOGICAL = 57689 +const LOGICALLY = 57690 +const LOGIN = 57691 +const LOOKUP = 57692 +const LOW = 57693 +const LSHIFT = 57694 +const MATCH = 57695 +const MATERIALIZED = 57696 +const MERGE = 57697 +const MINVALUE = 57698 +const MAXVALUE = 57699 +const METHOD = 57700 +const MINUTE = 57701 +const MODIFYCLUSTERSETTING = 57702 +const MODE = 57703 +const MONTH = 57704 +const MOVE = 57705 +const MULTILINESTRING = 57706 +const MULTILINESTRINGM = 57707 +const MULTILINESTRINGZ = 57708 +const MULTILINESTRINGZM = 57709 +const MULTIPOINT = 57710 +const MULTIPOINTM = 57711 +const MULTIPOINTZ = 57712 +const MULTIPOINTZM = 57713 +const MULTIPOLYGON = 57714 +const MULTIPOLYGONM = 57715 +const MULTIPOLYGONZ = 57716 +const MULTIPOLYGONZM = 57717 +const NAN = 57718 +const NAME = 57719 +const NAMES = 57720 +const NATURAL = 57721 +const NEG_INNER_PRODUCT = 57722 +const NEVER = 57723 +const NEW = 57724 +const NEWER = 57725 +const NEW_DB_NAME = 57726 +const NEW_KMS = 57727 +const NEXT = 57728 +const NO = 57729 +const NOBYPASSRLS = 57730 +const NOCANCELQUERY = 57731 +const NOCONTROLCHANGEFEED = 57732 +const NOCONTROLJOB = 57733 +const NOCREATEDB = 57734 +const NOCREATELOGIN = 57735 +const NOCREATEROLE = 57736 +const NODE = 57737 +const NOLOGIN = 57738 +const NOMODIFYCLUSTERSETTING = 57739 +const NOREPLICATION = 57740 +const NOSQLLOGIN = 57741 +const NO_INDEX_JOIN = 57742 +const NO_ZIGZAG_JOIN = 57743 +const NO_FULL_SCAN = 57744 +const NONE = 57745 +const NONVOTERS = 57746 +const NORMAL = 57747 +const NOT = 57748 +const NOTHING = 57749 +const NOTHING_AFTER_RETURNING = 57750 +const NOTNULL = 57751 +const NOVIEWACTIVITY = 57752 +const NOVIEWACTIVITYREDACTED = 57753 +const NOVIEWCLUSTERSETTING = 57754 +const NOWAIT = 57755 +const NULL = 57756 +const NULLIF = 57757 +const NULLS = 57758 +const NUMERIC = 57759 +const OF = 57760 +const OFF = 57761 +const OFFSET = 57762 +const OID = 57763 +const OIDS = 57764 +const OIDVECTOR = 57765 +const OLD = 57766 +const OLDER = 57767 +const OLD_KMS = 57768 +const ON = 57769 +const ONLY = 57770 +const OPT = 57771 +const OPTION = 57772 +const OPTIONS = 57773 +const OR = 57774 +const ORDER = 57775 +const ORDINALITY = 57776 +const OTHERS = 57777 +const OUT = 57778 +const OUTER = 57779 +const OVER = 57780 +const OVERLAPS = 57781 +const OVERLAY = 57782 +const OWNED = 57783 +const OWNER = 57784 +const OPERATOR = 57785 +const PARALLEL = 57786 +const PARENT = 57787 +const PARTIAL = 57788 +const PARTITION = 57789 +const PARTITIONS = 57790 +const PASSWORD = 57791 +const PAUSE = 57792 +const PAUSED = 57793 +const PER = 57794 +const PERMISSIVE = 57795 +const PHYSICAL = 57796 +const PLACEMENT = 57797 +const PLACING = 57798 +const PLAN = 57799 +const PLANS = 57800 +const POINT = 57801 +const POINTM = 57802 +const POINTZ = 57803 +const POINTZM = 57804 +const POLICIES = 57805 +const POLICY = 57806 +const POLYGON = 57807 +const POLYGONM = 57808 +const POLYGONZ = 57809 +const POLYGONZM = 57810 +const POSITION = 57811 +const PRECEDING = 57812 +const PRECISION = 57813 +const PREPARE = 57814 +const PREPARED = 57815 +const PRESERVE = 57816 +const PRIMARY = 57817 +const PRIOR = 57818 +const PRIORITY = 57819 +const PRIVILEGES = 57820 +const PUSH = 57821 +const PROCEDURAL = 57822 +const PROCEDURE = 57823 +const PROCEDURES = 57824 +const PROVISIONSRC = 57825 +const PUBLIC = 57826 +const PUBLICATION = 57827 +const QUERIES = 57828 +const QUERY = 57829 +const QUOTE = 57830 +const RANGE = 57831 +const RANGES = 57832 +const READ = 57833 +const REAL = 57834 +const REASON = 57835 +const REASSIGN = 57836 +const RECURSIVE = 57837 +const RECURRING = 57838 +const REDACT = 57839 +const REF = 57840 +const REFERENCES = 57841 +const REFERENCING = 57842 +const REFRESH = 57843 +const REGCLASS = 57844 +const REGION = 57845 +const REGIONAL = 57846 +const REGIONS = 57847 +const REGNAMESPACE = 57848 +const REGPROC = 57849 +const REGPROCEDURE = 57850 +const REGROLE = 57851 +const REGTYPE = 57852 +const REINDEX = 57853 +const RELATIVE = 57854 +const RELOCATE = 57855 +const REMOVE_PATH = 57856 +const REMOVE_REGIONS = 57857 +const RENAME = 57858 +const REPEATABLE = 57859 +const REPLACE = 57860 +const REPLICATED = 57861 +const REPLICATION = 57862 +const RELEASE = 57863 +const RESET = 57864 +const RESOLVED = 57865 +const RESTART = 57866 +const RESTORE = 57867 +const RESTRICT = 57868 +const RESTRICTED = 57869 +const RESTRICTIVE = 57870 +const RESUME = 57871 +const RETENTION = 57872 +const RETURNING = 57873 +const RETURN = 57874 +const RETURNS = 57875 +const REVISION = 57876 +const REVISION_HISTORY = 57877 +const REVOKE = 57878 +const RIGHT = 57879 +const ROLE = 57880 +const ROLES = 57881 +const ROLLBACK = 57882 +const ROLLUP = 57883 +const ROUTINES = 57884 +const ROW = 57885 +const ROWS = 57886 +const RSHIFT = 57887 +const RULE = 57888 +const RUN = 57889 +const RUNNING = 57890 +const SAVEPOINT = 57891 +const SCANS = 57892 +const SCATTER = 57893 +const SCHEDULE = 57894 +const SCHEDULES = 57895 +const SCROLL = 57896 +const SCHEMA = 57897 +const SCHEMA_ONLY = 57898 +const SCHEMAS = 57899 +const SCRUB = 57900 +const SEARCH = 57901 +const SECOND = 57902 +const SECONDARY = 57903 +const SECURITY = 57904 +const SECURITY_INVOKER = 57905 +const SELECT = 57906 +const SEQUENCE = 57907 +const SEQUENCES = 57908 +const SERIALIZABLE = 57909 +const SERVER = 57910 +const SERVICE = 57911 +const SESSION = 57912 +const SESSIONS = 57913 +const SESSION_USER = 57914 +const SET = 57915 +const SETOF = 57916 +const SETS = 57917 +const SETTING = 57918 +const SETTINGS = 57919 +const SHARE = 57920 +const SHARED = 57921 +const SHOW = 57922 +const SIMILAR = 57923 +const SIMPLE = 57924 +const SIZE = 57925 +const SKIP = 57926 +const SKIP_LOCALITIES_CHECK = 57927 +const SKIP_MISSING_FOREIGN_KEYS = 57928 +const SKIP_MISSING_SEQUENCES = 57929 +const SKIP_MISSING_SEQUENCE_OWNERS = 57930 +const SKIP_MISSING_VIEWS = 57931 +const SKIP_MISSING_UDFS = 57932 +const SMALLINT = 57933 +const SMALLSERIAL = 57934 +const SNAPSHOT = 57935 +const SOME = 57936 +const SOURCE = 57937 +const SPLIT = 57938 +const SQL = 57939 +const SQLLOGIN = 57940 +const STABLE = 57941 +const START = 57942 +const STATE = 57943 +const STATEMENT = 57944 +const STATISTICS = 57945 +const STATUS = 57946 +const STDIN = 57947 +const STDOUT = 57948 +const STOP = 57949 +const STRAIGHT = 57950 +const STREAM = 57951 +const STRICT = 57952 +const STRING = 57953 +const STORAGE = 57954 +const STORE = 57955 +const STORED = 57956 +const STORING = 57957 +const SUBJECT = 57958 +const SUBSTRING = 57959 +const SUPER = 57960 +const SUPPORT = 57961 +const SURVIVE = 57962 +const SURVIVAL = 57963 +const SYMMETRIC = 57964 +const SYNTAX = 57965 +const SYSTEM = 57966 +const SQRT = 57967 +const SUBSCRIPTION = 57968 +const STATEMENTS = 57969 +const TABLE = 57970 +const TABLES = 57971 +const TABLESPACE = 57972 +const TEMP = 57973 +const TEMPLATE = 57974 +const TEMPORARY = 57975 +const TENANT = 57976 +const TENANT_NAME = 57977 +const TENANTS = 57978 +const TESTING_RELOCATE = 57979 +const TEXT = 57980 +const THAN = 57981 +const THEN = 57982 +const TIES = 57983 +const TIME = 57984 +const TIMETZ = 57985 +const TIMESTAMP = 57986 +const TIMESTAMPTZ = 57987 +const TO = 57988 +const THROTTLING = 57989 +const TRAILING = 57990 +const TRACE = 57991 +const TRANSACTION = 57992 +const TRANSACTIONS = 57993 +const TRANSFER = 57994 +const TRANSFORM = 57995 +const TREAT = 57996 +const TRIGGER = 57997 +const TRIGGERS = 57998 +const TRIM = 57999 +const TRUE = 58000 +const TRUNCATE = 58001 +const TRUSTED = 58002 +const TYPE = 58003 +const TYPES = 58004 +const TRACING = 58005 +const UNBOUNDED = 58006 +const UNCOMMITTED = 58007 +const UNIDIRECTIONAL = 58008 +const UNION = 58009 +const UNIQUE = 58010 +const UNKNOWN = 58011 +const UNLISTEN = 58012 +const UNLOGGED = 58013 +const UNSAFE_RESTORE_INCOMPATIBLE_VERSION = 58014 +const UNSPLIT = 58015 +const UPDATE = 58016 +const UPDATES_CLUSTER_MONITORING_METRICS = 58017 +const UPSERT = 58018 +const UNSET = 58019 +const UNTIL = 58020 +const USE = 58021 +const USER = 58022 +const USERS = 58023 +const USING = 58024 +const UUID = 58025 +const VALID = 58026 +const VALIDATE = 58027 +const VALUE = 58028 +const VALUES = 58029 +const VARBIT = 58030 +const VARCHAR = 58031 +const VARIADIC = 58032 +const VECTOR = 58033 +const VERIFY_BACKUP_TABLE_DATA = 58034 +const VIEW = 58035 +const VARIABLES = 58036 +const VARYING = 58037 +const VIEWACTIVITY = 58038 +const VIEWACTIVITYREDACTED = 58039 +const VIEWCLUSTERSETTING = 58040 +const VIRTUAL = 58041 +const VISIBLE = 58042 +const INVISIBLE = 58043 +const VISIBILITY = 58044 +const VOLATILE = 58045 +const VOTERS = 58046 +const VIRTUAL_CLUSTER_NAME = 58047 +const VIRTUAL_CLUSTER = 58048 +const WATCHED_TABLES = 58049 +const WHEN = 58050 +const WHERE = 58051 +const WINDOW = 58052 +const WITH = 58053 +const WITHIN = 58054 +const WITHOUT = 58055 +const WORK = 58056 +const WRITE = 58057 +const YEAR = 58058 +const ZONE = 58059 +const NOT_LA = 58060 +const NULLS_LA = 58061 +const WITH_LA = 58062 +const AS_LA = 58063 +const GENERATED_ALWAYS = 58064 +const GENERATED_BY_DEFAULT = 58065 +const RESET_ALL = 58066 +const ROLE_ALL = 58067 +const USER_ALL = 58068 +const ON_LA = 58069 +const TENANT_ALL = 58070 +const CLUSTER_ALL = 58071 +const SET_TRACING = 58072 +const CREATE_CHANGEFEED_FOR_DATABASE = 58073 +const FOR_TABLE = 58074 +const FOR_JOB = 58075 +const EXECUTE_SCHEDULE = 58076 +const EXECUTE_SCHEDULES = 58077 +const CONTAINED_BY = 58078 +const POSTFIXOP = 58079 +const INTERVAL_SIMPLE = 58080 +const UMINUS = 58081 +const HELPTOKEN = 58082 diff --git a/pkg/sql/oidext/oidext.go b/pkg/sql/oidext/oidext.go index b629a94..9d477cb 100644 --- a/pkg/sql/oidext/oidext.go +++ b/pkg/sql/oidext/oidext.go @@ -31,11 +31,16 @@ const ( T__box2d = oid.Oid(90005) T_pgvector = oid.Oid(90006) T__pgvector = oid.Oid(90007) + T_citext = oid.Oid(90008) + T__citext = oid.Oid(90009) + T_ltree = oid.Oid(90010) + T__ltree = oid.Oid(90011) ) // OIDs in this block are not extensions of postgres, but are not supported in // github.com/lib/pq/oid. See postgres/src/include/catalog/pg_type.dat for oids. const ( + T_aclitem = oid.Oid(1033) T_jsonpath = oid.Oid(4072) T__jsonpath = oid.Oid(4073) ) @@ -53,6 +58,10 @@ var ExtensionTypeName = map[oid.Oid]string{ T__pgvector: "_VECTOR", T_jsonpath: "JSONPATH", T__jsonpath: "_JSONPATH", + T_citext: "CITEXT", + T__citext: "_CITEXT", + T_ltree: "LTREE", + T__ltree: "_LTREE", } // TypeName checks the name for a given type by first looking up oid.TypeName diff --git a/pkg/sql/parser/help_messages.go b/pkg/sql/parser/help_messages.go index f2c4944..41f11a1 100644 --- a/pkg/sql/parser/help_messages.go +++ b/pkg/sql/parser/help_messages.go @@ -4,20 +4,20 @@ package parser var helpMessages = map[string]HelpMessageBody{ - //line sql.y: 1925 + //line sql.y: 1980 `ALTER`: { - //line sql.y: 1926 + //line sql.y: 1981 Category: hGroup, - //line sql.y: 1927 - Text: `ALTER TABLE, ALTER INDEX, ALTER VIEW, ALTER SEQUENCE, ALTER DATABASE, ALTER USER, ALTER ROLE, ALTER DEFAULT PRIVILEGES + //line sql.y: 1982 + Text: `ALTER TABLE, ALTER INDEX, ALTER VIEW, ALTER SEQUENCE, ALTER DATABASE, ALTER USER, ALTER ROLE, ALTER DEFAULT PRIVILEGES,ALTER EXTERNAL CONNECTION `, }, - //line sql.y: 1954 + //line sql.y: 2010 `ALTER TABLE`: { ShortDescription: `change the definition of a table`, - //line sql.y: 1955 + //line sql.y: 2011 Category: hDDL, - //line sql.y: 1956 + //line sql.y: 2012 Text: ` ALTER TABLE [IF EXISTS] [, ...] @@ -67,16 +67,16 @@ Zone configurations: { TO | = } `, - //line sql.y: 2004 + //line sql.y: 2060 SeeAlso: `WEBDOCS/alter-table.html `, }, - //line sql.y: 2020 + //line sql.y: 2077 `ALTER PARTITION`: { ShortDescription: `apply zone configurations to a partition`, - //line sql.y: 2021 + //line sql.y: 2078 Category: hDDL, - //line sql.y: 2022 + //line sql.y: 2079 Text: ` ALTER PARTITION @@ -97,30 +97,30 @@ Zone configurations: { TO | = } `, - //line sql.y: 2041 + //line sql.y: 2098 SeeAlso: `WEBDOCS/alter-partition.html `, }, - //line sql.y: 2046 + //line sql.y: 2103 `ALTER VIEW`: { ShortDescription: `change the definition of a view`, - //line sql.y: 2047 + //line sql.y: 2104 Category: hDDL, - //line sql.y: 2048 + //line sql.y: 2105 Text: ` ALTER [MATERIALIZED] VIEW [IF EXISTS] RENAME TO ALTER [MATERIALIZED] VIEW [IF EXISTS] SET SCHEMA `, - //line sql.y: 2051 + //line sql.y: 2108 SeeAlso: `WEBDOCS/alter-view.html `, }, - //line sql.y: 2060 + //line sql.y: 2119 `ALTER SEQUENCE`: { ShortDescription: `change the definition of a sequence`, - //line sql.y: 2061 + //line sql.y: 2120 Category: hDDL, - //line sql.y: 2062 + //line sql.y: 2121 Text: ` ALTER SEQUENCE [IF EXISTS] [AS ] @@ -134,12 +134,12 @@ ALTER SEQUENCE [IF EXISTS] RENAME TO ALTER SEQUENCE [IF EXISTS] SET SCHEMA `, }, - //line sql.y: 2091 + //line sql.y: 2150 `ALTER DATABASE`: { ShortDescription: `change the definition of a database`, - //line sql.y: 2092 + //line sql.y: 2151 Category: hDDL, - //line sql.y: 2093 + //line sql.y: 2152 Text: ` ALTER DATABASE RENAME TO ALTER DATABASE CONFIGURE ZONE @@ -154,16 +154,16 @@ ALTER DATABASE SET var { TO | = } { value | DEFAULT } ALTER DATABASE RESET { var | ALL } ALTER DATABASE ALTER LOCALITY { GLOBAL | REGIONAL [IN ] } CONFIGURE ZONE `, - //line sql.y: 2106 + //line sql.y: 2165 SeeAlso: `WEBDOCS/alter-database.html `, }, - //line sql.y: 2125 + //line sql.y: 2184 `ALTER FUNCTION`: { ShortDescription: `change the definition of a function`, - //line sql.y: 2126 + //line sql.y: 2185 Category: hDDL, - //line sql.y: 2127 + //line sql.y: 2186 Text: ` ALTER FUNCTION name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] action [ ... ] [ RESTRICT ] @@ -181,16 +181,16 @@ where action is one of: [ NOT ] LEAKPROOF [ EXTERNAL ] SECURITY { INVOKER | DEFINER } `, - //line sql.y: 2143 + //line sql.y: 2202 SeeAlso: `WEBDOCS/alter-function.html `, }, - //line sql.y: 2152 + //line sql.y: 2211 `ALTER PROCEDURE`: { ShortDescription: `change the definition of a procedure`, - //line sql.y: 2153 + //line sql.y: 2212 Category: hDDL, - //line sql.y: 2154 + //line sql.y: 2213 Text: ` ALTER PROCEDURE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] RENAME TO new_name @@ -200,16 +200,16 @@ ALTER PROCEDURE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] SET SCHEMA new_schema `, - //line sql.y: 2162 + //line sql.y: 2221 SeeAlso: `WEBDOCS/alter-procedure.html `, }, - //line sql.y: 2356 + //line sql.y: 2415 `ALTER RANGE`: { ShortDescription: `change the parameters of a range`, - //line sql.y: 2357 + //line sql.y: 2416 Category: hDDL, - //line sql.y: 2358 + //line sql.y: 2417 Text: ` ALTER RANGE @@ -227,16 +227,16 @@ Zone configurations: { TO | = } `, - //line sql.y: 2374 + //line sql.y: 2433 SeeAlso: `ALTER TABLE `, }, - //line sql.y: 2380 + //line sql.y: 2439 `ALTER INDEX`: { ShortDescription: `change the definition of an index`, - //line sql.y: 2381 + //line sql.y: 2440 Category: hDDL, - //line sql.y: 2382 + //line sql.y: 2441 Text: ` ALTER INDEX [IF EXISTS] @@ -256,16 +256,16 @@ Zone configurations: { TO | = } `, - //line sql.y: 2400 + //line sql.y: 2459 SeeAlso: `WEBDOCS/alter-index.html `, }, - //line sql.y: 3187 + //line sql.y: 3310 `ALTER TYPE`: { ShortDescription: `change the definition of a type.`, - //line sql.y: 3188 + //line sql.y: 3311 Category: hDDL, - //line sql.y: 3189 + //line sql.y: 3312 Text: `ALTER TYPE Commands: @@ -283,26 +283,26 @@ Attribute action: ALTER ATTRIBUTE [ SET DATA ] TYPE [ COLLATE ] [ CASCADE | RESTRICT ] `, - //line sql.y: 3205 + //line sql.y: 3328 SeeAlso: `WEBDOCS/alter-type.html `, }, - //line sql.y: 3354 + //line sql.y: 3477 `REFRESH`: { ShortDescription: `recalculate a materialized view`, - //line sql.y: 3355 + //line sql.y: 3478 Category: hMisc, - //line sql.y: 3356 + //line sql.y: 3479 Text: ` REFRESH MATERIALIZED VIEW [CONCURRENTLY] view_name [AS OF SYSTEM TIME >] [WITH [NO] DATA] `, }, - //line sql.y: 3384 + //line sql.y: 3507 `BACKUP`: { ShortDescription: `back up data to external storage`, - //line sql.y: 3385 + //line sql.y: 3508 Category: hCCL, - //line sql.y: 3386 + //line sql.y: 3509 Text: ` Create a full backup @@ -335,20 +335,19 @@ Options: encryption_passphrase="secret": encrypt backups kms="[kms_provider]://[kms_host]/[master_key_identifier]?[parameters]" : encrypt backups using KMS detached: execute backup job asynchronously, without waiting for its completion - incremental_location: specify a different path to store the incremental backup include_all_virtual_clusters: enable backups of all virtual clusters during a cluster backup `, - //line sql.y: 3421 + //line sql.y: 3543 SeeAlso: `RESTORE, WEBDOCS/backup.html `, }, - //line sql.y: 3559 + //line sql.y: 3681 `CREATE SCHEDULE FOR BACKUP`: { ShortDescription: `backup data periodically`, - //line sql.y: 3560 + //line sql.y: 3682 Category: hCCL, - //line sql.y: 3561 + //line sql.y: 3683 Text: ` CREATE SCHEDULE [IF NOT EXISTS] [] @@ -420,16 +419,16 @@ FULL BACKUP : objects. `, - //line sql.y: 3631 + //line sql.y: 3753 SeeAlso: `BACKUP `, }, - //line sql.y: 3649 + //line sql.y: 3771 `ALTER BACKUP SCHEDULE`: { ShortDescription: `alter an existing backup schedule`, - //line sql.y: 3650 + //line sql.y: 3772 Category: hCCL, - //line sql.y: 3651 + //line sql.y: 3773 Text: ` ALTER BACKUP SCHEDULE [, ...] @@ -443,16 +442,32 @@ Commands: See CREATE SCHEDULE FOR BACKUP for detailed option descriptions. `, - //line sql.y: 3663 + //line sql.y: 3785 SeeAlso: `CREATE SCHEDULE FOR BACKUP `, }, - //line sql.y: 3811 + //line sql.y: 3932 + `ALTER EXTERNAL CONNECTION`: { + ShortDescription: `alter an existing external connection`, + //line sql.y: 3933 + Category: hMisc, + //line sql.y: 3934 + Text: ` +ALTER EXTERNAL CONNECTION [IF EXISTS] AS + +Name: + Name of the created external connection + +Endpoint: + Endpoint of the resource that the external connection represents. +`, + }, + //line sql.y: 3963 `CREATE EXTERNAL CONNECTION`: { ShortDescription: `create a new external connection`, - //line sql.y: 3812 + //line sql.y: 3964 Category: hMisc, - //line sql.y: 3813 + //line sql.y: 3965 Text: ` CREATE EXTERNAL CONNECTION [IF NOT EXISTS] AS @@ -463,12 +478,12 @@ Endpoint: Endpoint of the resource that the external connection represents. `, }, - //line sql.y: 3831 + //line sql.y: 3983 `CHECK EXTERNAL CONNECTION`: { ShortDescription: `check the status of an external connection`, - //line sql.y: 3832 + //line sql.y: 3984 Category: hMisc, - //line sql.y: 3833 + //line sql.y: 3985 Text: ` CREATE EXTERNAL CONNECTION [WITH ] @@ -476,12 +491,12 @@ Uri: Uri for the external connection. `, }, - //line sql.y: 3889 + //line sql.y: 4041 `DROP EXTERNAL CONNECTION`: { ShortDescription: `drop an existing external connection`, - //line sql.y: 3890 + //line sql.y: 4042 Category: hMisc, - //line sql.y: 3891 + //line sql.y: 4043 Text: ` DROP EXTERNAL CONNECTION @@ -489,12 +504,12 @@ Name: Unique name for this external connection. `, }, - //line sql.y: 3905 + //line sql.y: 4057 `RESTORE`: { ShortDescription: `restore data from external storage`, - //line sql.y: 3906 + //line sql.y: 4058 Category: hCCL, - //line sql.y: 3907 + //line sql.y: 4059 Text: ` RESTORE FROM [ AS OF SYSTEM TIME ] @@ -525,45 +540,31 @@ Options: new_db_name: renames the restored database. only applies to database restores include_all_virtual_clusters: enable backups of all virtual clusters during a cluster backup `, - //line sql.y: 3936 + //line sql.y: 4088 SeeAlso: `BACKUP, WEBDOCS/restore.html `, }, - //line sql.y: 4134 + //line sql.y: 4286 `IMPORT`: { ShortDescription: `load data from file in a distributed manner`, - //line sql.y: 4135 + //line sql.y: 4287 Category: hCCL, - //line sql.y: 4136 + //line sql.y: 4288 Text: ` --- Import both schema and table data: -IMPORT [ TABLE FROM ] - - [ WITH