Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
qw4990 committed Aug 8, 2023
1 parent 3296b5e commit 1a43b1c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions parser/lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ func (s *Scanner) reset(sql string) {
s.stmtStartPos = 0
s.inBangComment = false
s.lastKeyword = 0
s.identifierDot = true
}

func (s *Scanner) stmtText() string {
Expand Down
12 changes: 12 additions & 0 deletions parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7389,6 +7389,18 @@ func TestTTLTableOption(t *testing.T) {
RunTest(t, table, false)
}

func TestIssue45898(t *testing.T) {
p := parser.New()
p.ParseSQL("a.")
stmts, _, err := p.ParseSQL("select count(1) from t")
require.NoError(t, err)
var sb strings.Builder
restoreCtx := NewRestoreCtx(DefaultRestoreFlags, &sb)
sb.Reset()
stmts[0].Restore(restoreCtx)
require.Equal(t, sb.String(), "SELECT COUNT(1) FROM `t`")
}

func TestMultiStmt(t *testing.T) {
p := parser.New()
stmts, _, err := p.Parse("SELECT 'foo'; SELECT 'foo;bar','baz'; select 'foo' , 'bar' , 'baz' ;select 1", "", "")
Expand Down

0 comments on commit 1a43b1c

Please sign in to comment.