diff --git a/sql/exprs.go b/sql/exprs.go index bde2ad0f..d8ba4c3d 100644 --- a/sql/exprs.go +++ b/sql/exprs.go @@ -64,7 +64,7 @@ func (p *parser) parseWhat() (mul []Expr, err error) { func (p *parser) parseName() (string, error) { - _, lit, err := p.shouldBe(IDENT, NUMBER, DOUBLE) + _, lit, err := p.shouldBe(IDENT, STRING, NUMBER, DOUBLE) if err != nil { return string(""), &ParseError{Found: lit, Expected: []string{"name"}} } diff --git a/sql/login.go b/sql/login.go index 88fc8353..d63ea7d7 100644 --- a/sql/login.go +++ b/sql/login.go @@ -18,6 +18,10 @@ func (p *parser) parseDefineLoginStatement() (stmt *DefineLoginStatement, err er stmt = &DefineLoginStatement{} + if stmt.User, err = p.parseName(); err != nil { + return nil, err + } + if _, _, err = p.shouldBe(ON); err != nil { return nil, err } @@ -38,14 +42,6 @@ func (p *parser) parseDefineLoginStatement() (stmt *DefineLoginStatement, err er } } - if _, _, err := p.shouldBe(USERNAME); err != nil { - return nil, err - } - - if stmt.User, err = p.parseString(); err != nil { - return nil, err - } - if _, _, err := p.shouldBe(PASSWORD); err != nil { return nil, err } @@ -70,6 +66,10 @@ func (p *parser) parseRemoveLoginStatement() (stmt *RemoveLoginStatement, err er stmt = &RemoveLoginStatement{} + if stmt.User, err = p.parseName(); err != nil { + return nil, err + } + if _, _, err = p.shouldBe(ON); err != nil { return nil, err } @@ -90,14 +90,6 @@ func (p *parser) parseRemoveLoginStatement() (stmt *RemoveLoginStatement, err er } } - if _, _, err := p.shouldBe(USERNAME); err != nil { - return nil, err - } - - if stmt.User, err = p.parseString(); err != nil { - return nil, err - } - if _, _, err = p.shouldBe(EOF, SEMICOLON); err != nil { return nil, err } diff --git a/sql/tokens.go b/sql/tokens.go index 5e60fd1c..4bb198ee 100644 --- a/sql/tokens.go +++ b/sql/tokens.go @@ -183,7 +183,6 @@ const ( UPDATE UPSERT USE - USERNAME VALIDATE VERSION VIEW @@ -346,7 +345,6 @@ var tokens = [...]string{ UPDATE: "UPDATE", UPSERT: "UPSERT", USE: "USE", - USERNAME: "USERNAME", VALIDATE: "VALIDATE", VERSION: "VERSION", VIEW: "VIEW",