Skip to content
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

Grammar fixes for customer issue using non-reserved keywords in insert into statements #189

Merged
merged 6 commits into from
Sep 15, 2022
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions go/vt/sqlparser/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6290,19 +6290,23 @@ var incorrectlyParse = []string{
}

// TestKeywordsCorrectlyParse ensures that certain keywords can be parsed by a series of edit queries.
func TestKeywordsCorrectlyDoParse(t *testing.T) {
func TestKeywordsCorrectlyParse(t *testing.T) {
aliasTest := "SELECT 1 as %s"
iTest := "INSERT INTO t (%s) VALUES (1)"
iTest1 := "INSERT INTO t_t (%s) VALUES ('one')"
iTest2 := "INSERT INTO t_t (pk, %s) VALUES (1, 'one')"
iTest3 := "INSERT INTO t_t (pk, %s, c1) VALUES (1, 'one', 1)"
dTest := "DELETE FROM t where %s=1"
uTest := "UPDATE t SET %s=1"
cTest := "CREATE TABLE t(%s int)"
cTest1 := "CREATE TABLE t(%s int)"
cTest2 := "CREATE TABLE t(foo int, %s int)"
cTest3 := "CREATE TABLE t(foo int, %s int, foo int)"
tTest := "CREATE TABLE %s(i int)"
tcTest := "SELECT * FROM t ORDER BY t.%s"
sTest := "SELECT %s.c FROM t"
dropConstraintTest := "ALTER TABLE t DROP CONSTRAINT %s"
dropCheckTest := "ALTER TABLE t DROP CHECK %s"

tests := []string{aliasTest, iTest, dTest, uTest, cTest, tTest, tcTest, sTest, dropConstraintTest, dropCheckTest}
tests := []string{aliasTest, iTest1, iTest2, iTest3, dTest, uTest, cTest1, cTest2, cTest3, tTest, tcTest, sTest, dropConstraintTest, dropCheckTest}

for _, kw := range correctlyDoParse {
for _, query := range tests {
Expand Down
Loading