Skip to content

Parser: 25.2 snapshot #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21
go-version: 1.23

- name: Build
run: go build -v ./...
Expand Down
63 changes: 41 additions & 22 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,50 +1,69 @@
module github.com/cockroachdb/cockroachdb-parser

go 1.21.1

toolchain go1.21.3
go 1.23.8

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/errors v1.9.0
github.com/cockroachdb/errors v1.11.3
github.com/cockroachdb/gostdlib v1.19.0
github.com/cockroachdb/redact v1.1.3
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/dave/dst v0.27.2
github.com/dustin/go-humanize v1.0.0
github.com/elastic/gosigar v0.14.3
github.com/gogo/protobuf v1.3.2
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551
github.com/google/go-cmp v0.5.8
github.com/google/go-cmp v0.7.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/jaegertracing/jaeger v1.18.1
github.com/lib/pq v1.10.6
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5
github.com/pierrre/geohash v1.0.0
github.com/pmezard/go-difflib v1.0.0
github.com/sasha-s/go-deadlock v0.3.1
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.7.0
github.com/stretchr/testify v1.10.0
github.com/twpayne/go-geom v1.4.1
go.opentelemetry.io/otel v1.36.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.36.0
go.opentelemetry.io/otel/exporters/zipkin v1.36.0
go.opentelemetry.io/otel/sdk v1.36.0
go.opentelemetry.io/otel/trace v1.36.0
golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3
golang.org/x/text v0.14.0
golang.org/x/tools v0.17.0
golang.org/x/net v0.40.0
golang.org/x/sys v0.33.0
golang.org/x/text v0.25.0
golang.org/x/tools v0.26.0
gonum.org/v1/gonum v0.16.0
google.golang.org/grpc v1.72.1
google.golang.org/protobuf v1.36.6
)

require (
github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f // indirect
github.com/cenkalti/backoff/v5 v5.0.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/getsentry/sentry-go v0.12.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/getsentry/sentry-go v0.27.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
github.com/openzipkin/zipkin-go v0.4.3 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.8.1 // indirect
github.com/rogpeppe/go-internal v1.13.1 // indirect
github.com/twpayne/go-kml v1.5.2 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/sys v0.15.0 // indirect
google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84 // indirect
google.golang.org/grpc v1.40.1 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.36.0 // indirect
go.opentelemetry.io/otel/metric v1.36.0 // indirect
go.opentelemetry.io/proto/otlp v1.6.0 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/sync v0.14.0 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
672 changes: 423 additions & 249 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ func TestParser(t *testing.T) {
p, err := parser.ParseOne("CREATE TABLE t (a TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP)")
require.NoError(t, err)
f := tree.DefaultPrettyCfg()
f.Pretty(p.AST)
t.Log(f.Pretty(p.AST))
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/pkg/sql/sem/tree/type_name.go b/pkg/sql/sem/tree/type_name.go
index 898009a..5d4423a 100644
index 10cd908..98daa0e 100644
--- a/pkg/sql/sem/tree/type_name.go
+++ b/pkg/sql/sem/tree/type_name.go
@@ -56,8 +56,7 @@ func (t *TypeName) String() string {
@@ -42,8 +42,7 @@ func (t *TypeName) Format(ctx *FmtCtx) {

// SQLString implements the ResolvableTypeReference interface.
func (t *TypeName) SQLString() string {
Expand All @@ -11,8 +11,8 @@ index 898009a..5d4423a 100644
+ return AsStringWithFlags(t, FmtSimple)
}

// FQString renders the type name in full, not omitting the prefix
@@ -250,14 +249,12 @@ func (node *ArrayTypeReference) Format(ctx *FmtCtx) {
func (t *TypeName) objectName() {}
@@ -240,14 +239,12 @@ func (node *ArrayTypeReference) Format(ctx *FmtCtx) {

// SQLString implements the ResolvableTypeReference interface.
func (node *ArrayTypeReference) SQLString() string {
Expand Down
35 changes: 35 additions & 0 deletions patches/0004-enc-always-quoted.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
diff --git a/pkg/sql/lexbase/encode.go b/pkg/sql/lexbase/encode.go
index 0083555..47b9a37 100644
--- a/pkg/sql/lexbase/encode.go
+++ b/pkg/sql/lexbase/encode.go
@@ -49,6 +49,11 @@ const (
// EncFirstFreeFlagBit needs to remain unused; it is used as base
// bit offset for tree.FmtFlags.
EncFirstFreeFlagBit
+
+ // EncAlwaysQuoted makes sure the string is always wrapped with quotes.
+ // This is used only to construct a statement against Oracle source,
+ // as Oracle is case insensitive if object name is not quoted.
+ EncAlwaysQuoted
)

// EncodeRestrictedSQLIdent writes the identifier in s to buf. The
@@ -56,8 +61,7 @@ const (
// contains special characters, or the identifier is a reserved SQL
// keyword.
func EncodeRestrictedSQLIdent(buf *bytes.Buffer, s string, flags EncodeFlags) {
- if flags.HasFlags(EncBareIdentifiers) ||
- (IsBareIdentifier(s) && (flags.HasFlags(EncBareReservedKeywords) || !isReservedKeyword(s))) {
+ if !flags.HasFlags(EncAlwaysQuoted) && (flags.HasFlags(EncBareIdentifiers) || (!isReservedKeyword(s) && IsBareIdentifier(s))) {
buf.WriteString(s)
return
}
@@ -68,7 +72,7 @@ func EncodeRestrictedSQLIdent(buf *bytes.Buffer, s string, flags EncodeFlags) {
// The identifier is only quoted if the flags don't tell otherwise and
// the identifier contains special characters.
func EncodeUnrestrictedSQLIdent(buf *bytes.Buffer, s string, flags EncodeFlags) {
- if flags.HasFlags(EncBareIdentifiers) || IsBareIdentifier(s) {
+ if !flags.HasFlags(EncAlwaysQuoted) && (flags.HasFlags(EncBareIdentifiers) || IsBareIdentifier(s)) {
buf.WriteString(s)
return
}
64 changes: 0 additions & 64 deletions patches/0004-fix-bazel-compl.patch

This file was deleted.

Loading