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

[bug] create index synatx #592

Closed
BohuTANG opened this issue Mar 29, 2020 · 3 comments
Closed

[bug] create index synatx #592

BohuTANG opened this issue Mar 29, 2020 · 3 comments
Assignees
Labels
P0 High priority type: bug Something isn't working
Milestone

Comments

@BohuTANG
Copy link
Contributor

Summary

CREATE INDEX idx ON table(col);

doesn't work at v1.0.8, we should backport this patch from vitess(renamed 'force eof' -> 'skip to end') to fix it:
vitessio/vitess@4409977

@BohuTANG BohuTANG added type: bug Something isn't working P0 High priority labels Mar 29, 2020
@BohuTANG BohuTANG added this to the v1.0.9 milestone Mar 29, 2020
@zhyass
Copy link
Contributor

zhyass commented Mar 29, 2020

First, we need to fix the create index bug.

mysql> create index b_c_idx on t1(b,c); 
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

@zhyass
Copy link
Contributor

zhyass commented Mar 30, 2020

syntax:

CREATE [UNIQUE | FULLTEXT] INDEX index_name
    [index_type]
    ON tbl_name (key_part,...)
    [index_option]
    [algorithm_option | lock_option] ...
	
key_part:
    col_name [(length)] [ASC | DESC]

index_option:
    KEY_BLOCK_SIZE [=] value
  | index_type
  | WITH PARSER parser_name
  | COMMENT 'string'

index_type:
    USING {BTREE | HASH}

algorithm_option:
    ALGORITHM [=] {DEFAULT | INPLACE | COPY}

lock_option:
    LOCK [=] {DEFAULT | NONE | SHARED | EXCLUSIVE}

zhyass added a commit to zhyass/radon that referenced this issue Apr 3, 2020
[summary]
1. create index syntax.
CREATE [UNIQUE | FULLTEXT | SPATIAL] INDEX index_name
    ON tbl_name (key_part,...)
    [index_option]
    [algorithm_option | lock_option] ...

key_part:
    col_name [(length)]

index_option:
    KEY_BLOCK_SIZE [=] value
  | index_type
  | WITH PARSER ngram
  | COMMENT 'string'

index_type:
    USING {BTREE | HASH}

algorithm_option:
    ALGORITHM [=] {DEFAULT | INPLACE | COPY}

lock_option:
    LOCK [=] {DEFAULT | NONE | SHARED | EXCLUSIVE}

2. create table index definition syntax.
index_definition:
    PRIMARY KEY (key_part,...)
  | UNIQUE [index_or_key] index_name (key_part,...) [index_option]
  | index_or_key index_name (key_part,...) [index_option]
  | FULLTEXT index_or_key index_name (key_part,...) [index_option]
  | SPATIAL index_or_key index_name (key_part,...) [index_option]
index_or_key:
    INDEX
  | KEY

[test case]
src/planner/ddl_plan_test.go
src/vendor/github.com/xelabs/go-mysqlstack/sqlparser/ddl_test.go
src/vendor/github.com/xelabs/go-mysqlstack/sqlparser/parse_test.go
[patch codecov]
src/planner/ddl_plan.go 93.8%
src/vendor/github.com/xelabs/go-mysqlstack/sqlparser/ast.go 86.4%
@zhyass
Copy link
Contributor

zhyass commented Apr 3, 2020

1. create index syntax.
CREATE [UNIQUE | FULLTEXT | SPATIAL] INDEX index_name
    ON tbl_name (key_part,...)
    [index_option]
    [algorithm_option | lock_option] ...

key_part:
    col_name [(length)]

index_option:
    KEY_BLOCK_SIZE [=] value
  | index_type
  | WITH PARSER ngram
  | COMMENT 'string'

index_type:
    USING {BTREE | HASH}

algorithm_option:
    ALGORITHM [=] {DEFAULT | INPLACE | COPY}

lock_option:
    LOCK [=] {DEFAULT | NONE | SHARED | EXCLUSIVE}

2. create table index definition syntax.
index_definition:
    PRIMARY KEY (key_part,...)
  | UNIQUE [index_or_key] index_name (key_part,...) [index_option]
  | index_or_key index_name (key_part,...) [index_option]
  | FULLTEXT index_or_key index_name (key_part,...) [index_option]
  | SPATIAL index_or_key index_name (key_part,...) [index_option]

index_or_key:
    INDEX
  | KEY

zhyass added a commit to zhyass/radon that referenced this issue Apr 3, 2020
[summary]
1. create index syntax.
CREATE [UNIQUE | FULLTEXT | SPATIAL] INDEX index_name
    ON tbl_name (key_part,...)
    [index_option]
    [algorithm_option | lock_option] ...

key_part:
    col_name [(length)]

index_option:
    KEY_BLOCK_SIZE [=] value
  | index_type
  | WITH PARSER NGRAM
  | COMMENT 'string'

index_type:
    USING {BTREE | HASH}

algorithm_option:
    ALGORITHM [=] {DEFAULT | INPLACE | COPY}

lock_option:
    LOCK [=] {DEFAULT | NONE | SHARED | EXCLUSIVE}

2. create table index definition syntax.
index_definition:
    PRIMARY KEY (key_part,...)
  | UNIQUE [index_or_key] index_name (key_part,...) [index_option]
  | index_or_key index_name (key_part,...) [index_option]
  | FULLTEXT index_or_key index_name (key_part,...) [index_option]
  | SPATIAL index_or_key index_name (key_part,...) [index_option]

index_or_key:
    INDEX
  | KEY

[test case]
src/planner/ddl_plan_test.go
src/vendor/github.com/xelabs/go-mysqlstack/sqlparser/ddl_test.go
src/vendor/github.com/xelabs/go-mysqlstack/sqlparser/parse_test.go
[patch codecov]
src/planner/ddl_plan.go 93.8%
src/vendor/github.com/xelabs/go-mysqlstack/sqlparser/ast.go 86.4%
zhyass added a commit to zhyass/radon that referenced this issue Apr 3, 2020
[summary]
1. create index syntax.
CREATE [UNIQUE | FULLTEXT | SPATIAL] INDEX index_name
    ON tbl_name (key_part,...)
    [index_option]
    [algorithm_option | lock_option] ...

key_part:
    col_name [(length)]

index_option:
    KEY_BLOCK_SIZE [=] value
  | index_type
  | WITH PARSER NGRAM
  | COMMENT 'string'

index_type:
    USING {BTREE | HASH}

algorithm_option:
    ALGORITHM [=] {DEFAULT | INPLACE | COPY}

lock_option:
    LOCK [=] {DEFAULT | NONE | SHARED | EXCLUSIVE}

2. create table index definition syntax.
index_definition:
    PRIMARY KEY (key_part,...)
  | UNIQUE [index_or_key] index_name (key_part,...) [index_option]
  | index_or_key index_name (key_part,...) [index_option]
  | FULLTEXT index_or_key index_name (key_part,...) [index_option]
  | SPATIAL index_or_key index_name (key_part,...) [index_option]

index_or_key:
    INDEX
  | KEY

[test case]
src/planner/ddl_plan_test.go
src/vendor/github.com/xelabs/go-mysqlstack/sqlparser/ddl_test.go
src/vendor/github.com/xelabs/go-mysqlstack/sqlparser/parse_test.go
[patch codecov]
src/planner/ddl_plan.go 93.8%
src/vendor/github.com/xelabs/go-mysqlstack/sqlparser/ast.go 86.4%
zhyass added a commit to zhyass/radon that referenced this issue Apr 3, 2020
[summary]
1. create index syntax.
CREATE [UNIQUE | FULLTEXT | SPATIAL] INDEX index_name
    ON tbl_name (key_part,...)
    [index_option]
    [algorithm_option | lock_option] ...

key_part:
    col_name [(length)]

index_option:
    KEY_BLOCK_SIZE [=] value
  | index_type
  | WITH PARSER NGRAM
  | COMMENT 'string'

index_type:
    USING {BTREE | HASH}

algorithm_option:
    ALGORITHM [=] {DEFAULT | INPLACE | COPY}

lock_option:
    LOCK [=] {DEFAULT | NONE | SHARED | EXCLUSIVE}

2. create table index definition syntax.
index_definition:
    PRIMARY KEY (key_part,...)
  | UNIQUE [index_or_key] index_name (key_part,...) [index_option]
  | index_or_key index_name (key_part,...) [index_option]
  | FULLTEXT index_or_key index_name (key_part,...) [index_option]
  | SPATIAL index_or_key index_name (key_part,...) [index_option]

index_or_key:
    INDEX
  | KEY

[test case]
src/planner/ddl_plan_test.go
src/vendor/github.com/xelabs/go-mysqlstack/sqlparser/ddl_test.go
src/vendor/github.com/xelabs/go-mysqlstack/sqlparser/parse_test.go
[patch codecov]
src/planner/ddl_plan.go 93.8%
src/vendor/github.com/xelabs/go-mysqlstack/sqlparser/ast.go 86.4%
zhyass added a commit to zhyass/radon that referenced this issue Apr 4, 2020
[summary]
1. create index syntax.
CREATE [UNIQUE | FULLTEXT | SPATIAL] INDEX index_name
    ON tbl_name (key_part,...)
    [index_option]
    [algorithm_option | lock_option] ...

key_part:
    col_name [(length)]

index_option:
    KEY_BLOCK_SIZE [=] value
  | index_type
  | WITH PARSER NGRAM
  | COMMENT 'string'

index_type:
    USING {BTREE | HASH}

algorithm_option:
    ALGORITHM [=] {DEFAULT | INPLACE | COPY}

lock_option:
    LOCK [=] {DEFAULT | NONE | SHARED | EXCLUSIVE}

2. create table index definition syntax.
index_definition:
    PRIMARY KEY (key_part,...)
  | UNIQUE [index_or_key] index_name (key_part,...) [index_option]
  | index_or_key index_name (key_part,...) [index_option]
  | FULLTEXT index_or_key index_name (key_part,...) [index_option]
  | SPATIAL index_or_key index_name (key_part,...) [index_option]

index_or_key:
    INDEX
  | KEY

[test case]
src/planner/ddl_plan_test.go
src/vendor/github.com/xelabs/go-mysqlstack/sqlparser/ddl_test.go
src/vendor/github.com/xelabs/go-mysqlstack/sqlparser/parse_test.go
[patch codecov]
src/planner/ddl_plan.go 93.8%
src/vendor/github.com/xelabs/go-mysqlstack/sqlparser/ast.go 86.4%
zhyass added a commit to zhyass/radon that referenced this issue Apr 4, 2020
[summary]
1. create index syntax.
CREATE [UNIQUE | FULLTEXT | SPATIAL] INDEX index_name
    ON tbl_name (key_part,...)
    [index_option]
    [algorithm_option | lock_option] ...

key_part:
    col_name [(length)]

index_option:
    KEY_BLOCK_SIZE [=] value
  | index_type
  | WITH PARSER NGRAM
  | COMMENT 'string'

index_type:
    USING {BTREE | HASH}

algorithm_option:
    ALGORITHM [=] {DEFAULT | INPLACE | COPY}

lock_option:
    LOCK [=] {DEFAULT | NONE | SHARED | EXCLUSIVE}

2. create table index definition syntax.
index_definition:
    PRIMARY KEY (key_part,...)
  | UNIQUE [index_or_key] index_name (key_part,...) [index_option]
  | index_or_key index_name (key_part,...) [index_option]
  | FULLTEXT index_or_key index_name (key_part,...) [index_option]
  | SPATIAL index_or_key index_name (key_part,...) [index_option]

index_or_key:
    INDEX
  | KEY

[test case]
src/planner/ddl_plan_test.go
src/vendor/github.com/xelabs/go-mysqlstack/sqlparser/ddl_test.go
src/vendor/github.com/xelabs/go-mysqlstack/sqlparser/parse_test.go
[patch codecov]
src/planner/ddl_plan.go 93.8%
src/vendor/github.com/xelabs/go-mysqlstack/sqlparser/ast.go 86.4%
BohuTANG pushed a commit that referenced this issue Apr 5, 2020
[summary]
1. create index syntax.
CREATE [UNIQUE | FULLTEXT | SPATIAL] INDEX index_name
    ON tbl_name (key_part,...)
    [index_option]
    [algorithm_option | lock_option] ...

key_part:
    col_name [(length)]

index_option:
    KEY_BLOCK_SIZE [=] value
  | index_type
  | WITH PARSER NGRAM
  | COMMENT 'string'

index_type:
    USING {BTREE | HASH}

algorithm_option:
    ALGORITHM [=] {DEFAULT | INPLACE | COPY}

lock_option:
    LOCK [=] {DEFAULT | NONE | SHARED | EXCLUSIVE}

2. create table index definition syntax.
index_definition:
    PRIMARY KEY (key_part,...)
  | UNIQUE [index_or_key] index_name (key_part,...) [index_option]
  | index_or_key index_name (key_part,...) [index_option]
  | FULLTEXT index_or_key index_name (key_part,...) [index_option]
  | SPATIAL index_or_key index_name (key_part,...) [index_option]

index_or_key:
    INDEX
  | KEY

[test case]
src/planner/ddl_plan_test.go
src/vendor/github.com/xelabs/go-mysqlstack/sqlparser/ddl_test.go
src/vendor/github.com/xelabs/go-mysqlstack/sqlparser/parse_test.go
[patch codecov]
src/planner/ddl_plan.go 93.8%
src/vendor/github.com/xelabs/go-mysqlstack/sqlparser/ast.go 86.4%
@zhyass zhyass closed this as completed Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P0 High priority type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants