Skip to content

Commit 1e00b30

Browse files
craig[bot]mw5h
andcommitted
Merge #156131
156131: cmd/reduce: fix parsing of DO blocks r=mw5h a=mw5h Parsing DO blocks requires that plpgsql be initialized, which reduce previously failed to do, causing it to SEGV upon encountering a DO block in the file being reduced. This change imports the plpgsql parser to hit its init() function, which resolves the issue. Epic: none Release note: None Co-authored-by: Matt White <[email protected]>
2 parents b97d3b3 + eb8ada6 commit 1e00b30

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

pkg/cmd/reduce/reduce/reducesql/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ go_library(
99
"//pkg/cmd/reduce/reduce",
1010
"//pkg/sql/parser",
1111
"//pkg/sql/parser/statements",
12+
"//pkg/sql/plpgsql/parser",
1213
"//pkg/sql/sem/builtins",
1314
"//pkg/sql/sem/tree",
1415
],

pkg/cmd/reduce/reduce/reducesql/reducesql.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ import (
1414
"github.com/cockroachdb/cockroach/pkg/cmd/reduce/reduce"
1515
"github.com/cockroachdb/cockroach/pkg/sql/parser"
1616
"github.com/cockroachdb/cockroach/pkg/sql/parser/statements"
17+
// Ensure that sql/parser.ParseDoBlockFn is injected from the PLpgSQL
18+
// parser.
19+
_ "github.com/cockroachdb/cockroach/pkg/sql/plpgsql/parser"
1720
// Import builtins.
1821
_ "github.com/cockroachdb/cockroach/pkg/sql/sem/builtins"
1922
"github.com/cockroachdb/cockroach/pkg/sql/sem/tree"

0 commit comments

Comments
 (0)