File tree Expand file tree Collapse file tree 3 files changed +5
-3
lines changed
Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Original file line number Diff line number Diff line change 88)
99
1010func TestParser (t * testing.T ) {
11- _ , err := parser .Parse ("SELECT 1 " )
11+ _ , err := parser .Parse ("CREATE TABLE t (a TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP) " )
1212 require .NoError (t , err )
1313}
Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ import (
1919 "github.com/cockroachdb/cockroachdb-parser/pkg/sql/pgwire/pgerror"
2020 "github.com/cockroachdb/cockroachdb-parser/pkg/sql/sem/catconstants"
2121 "github.com/cockroachdb/errors"
22- "github.com/cockroachdb/redact"
2322 "github.com/lib/pq/oid"
2423)
2524
@@ -144,7 +143,7 @@ type CustomBuiltinFunctionWrapper interface {
144143func WrapFunction (n string ) ResolvableFunctionReference {
145144 fd , ok := FunDefs [n ]
146145 if ! ok {
147- panic ( errors . AssertionFailedf ( "function %s() not defined" , redact . Safe ( n )))
146+ return ResolvableFunctionReference { & FunctionDefinition { Name : n }}
148147 }
149148 return ResolvableFunctionReference {fd }
150149}
Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ rm pkg/sql/lexbase/.gitignore pkg/sql/parser/.gitignore
4242find pkg -type f -name ' *_test.go' | xargs rm
4343# sed replace any instances of cockroachdb
4444find pkg -type f -name ' *.go' | xargs sed -i ' ' -e ' s_github\.com/cockroachdb/cockroach/_github.com/cockroachdb/cockroachdb-parser/_g'
45+ # replace WrapFunction
46+ sed -i ' ' -e ' s_panic(errors.AssertionFailedf("function %s() not defined", redact.Safe(n)))_return ResolvableFunctionReference{\&FunctionDefinition{Name: n}}_g' pkg/sql/sem/tree/function_name.go
47+ goimports -w pkg/sql/sem/tree/function_name.go
4548
4649echo " Cleaning up go and testing everything works"
4750go mod tidy
You can’t perform that action at this time.
0 commit comments