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

[feature] complete syntax on DELETE Statement #713

Closed
hustjieke opened this issue Dec 10, 2020 · 0 comments
Closed

[feature] complete syntax on DELETE Statement #713

hustjieke opened this issue Dec 10, 2020 · 0 comments
Assignees
Labels
P0 High priority type: feature

Comments

@hustjieke
Copy link
Contributor

MySQL 8.0:
Single-table(radon fully compatible with MySQL):

DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name [[AS] tbl_alias]
    [PARTITION (partition_name [, partition_name] ...)]
    [WHERE where_condition]
    [ORDER BY ...]
    [LIMIT row_count]

Multi-table(radon now support at the grammatical level, specific functions are temporarily not supported):

DELETE [LOW_PRIORITY] [QUICK] [IGNORE]
    tbl_name[.*] [, tbl_name[.*]] ...
    FROM table_references
    [WHERE where_condition]

DELETE [LOW_PRIORITY] [QUICK] [IGNORE]
    FROM tbl_name[.*] [, tbl_name[.*]] ...
    USING table_references
    [WHERE where_condition]
@hustjieke hustjieke added type: feature P0 High priority labels Dec 10, 2020
@hustjieke hustjieke self-assigned this Dec 10, 2020
hustjieke added a commit to hustjieke/radon that referenced this issue Dec 31, 2020
[summary]
1. complete single-table syntax, add delete options and parition.
2. add support to parse multi-table syntax.
3. add support to delete without where clause, like "delete from t1
limit 2"

[test case]
sqlparser/ast_test.go
sqlparser/parse_test.go
sqlparser/ast_test.go
src/planner/builder/expr_test.go
src/planner/delete_plan_test.go

[patch codecov]
sqlparser/ast.go 96.1%
sqlparser/ast_funcs.go 94.4%
src/planner/delete_plan.go  93.9%
src/planner/update_plan.go  95.1%
hustjieke added a commit to hustjieke/radon that referenced this issue Dec 31, 2020
[summary]
1. complete single-table syntax, add delete options and parition.
2. add support to parse multi-table syntax.
3. add support to delete without where clause, like "delete from t1
limit 2"

[test case]
sqlparser/ast_test.go
sqlparser/parse_test.go
sqlparser/ast_test.go
src/planner/builder/expr_test.go
src/planner/delete_plan_test.go

[patch codecov]
sqlparser/ast.go 96.1%
sqlparser/ast_funcs.go 94.4%
src/planner/delete_plan.go  93.9%
src/planner/update_plan.go  95.1%
hustjieke added a commit to hustjieke/radon that referenced this issue Jan 5, 2021
[summary]
add more test to improve the codecov of queryz.go and delete_plan.go

[test case]
src/backend/queryz_test.go
src/planner/delete_plan_test.go

[patch codecov]
src/backend/queryz.go 96.3%
src/planner/delete_plan.go 95.9%
hustjieke added a commit to hustjieke/radon that referenced this issue Jan 5, 2021
[summary]
add more test to improve the codecov of queryz.go and delete_plan.go

[test case]
src/backend/queryz_test.go
src/planner/delete_plan_test.go

[patch codecov]
src/backend/queryz.go 96.3%
src/planner/delete_plan.go 95.9%
hustjieke added a commit to hustjieke/radon that referenced this issue Jan 21, 2021
[summary]
1. complete single-table syntax, add delete options and parition.
2. add support to parse multi-table syntax.
3. add support to delete without where clause, like "delete from t1
limit 2"

[test case]
sqlparser/ast_test.go
sqlparser/parse_test.go
sqlparser/ast_test.go
src/planner/builder/expr_test.go
src/planner/delete_plan_test.go

[patch codecov]
sqlparser/ast.go 96.1%
sqlparser/ast_funcs.go 94.4%
src/planner/delete_plan.go  93.9%
src/planner/update_plan.go  95.1%
hustjieke added a commit to hustjieke/radon that referenced this issue Jan 21, 2021
[summary]
add more test to improve the codecov of queryz.go and delete_plan.go

[test case]
src/backend/queryz_test.go
src/planner/delete_plan_test.go

[patch codecov]
src/backend/queryz.go 96.3%
src/planner/delete_plan.go 95.9%
hustjieke added a commit to hustjieke/radon that referenced this issue Jan 21, 2021
hustjieke added a commit to hustjieke/radon that referenced this issue Jan 21, 2021
[summary]
1. complete single-table syntax, add delete options and parition.
2. add support to parse multi-table syntax.
3. add support to delete without where clause, like "delete from t1
limit 2"

[test case]
sqlparser/ast_test.go
sqlparser/parse_test.go
sqlparser/ast_test.go
src/planner/builder/expr_test.go
src/planner/delete_plan_test.go

[patch codecov]
sqlparser/ast.go 96.1%
sqlparser/ast_funcs.go 94.4%
src/planner/delete_plan.go  93.9%
src/planner/update_plan.go  95.1%
hustjieke added a commit to hustjieke/radon that referenced this issue Jan 21, 2021
[summary]
add more test to improve the codecov of queryz.go and delete_plan.go

[test case]
src/backend/queryz_test.go
src/planner/delete_plan_test.go

[patch codecov]
src/backend/queryz.go 96.3%
src/planner/delete_plan.go 95.9%
hustjieke added a commit to hustjieke/radon that referenced this issue Jan 21, 2021
[summary]
1. add checkField() function to check the column field illegal or not if
the delete statment has field in where | order by clause.
e.g.:
mysql> delete from t where x.a=1;
ERROR 1054 (42S22): Unknown column 'x.a' in 'where clause'
mysql> delete from t where t.a=1 order by xx.a;
ERROR 1054 (42S22): Unknown column 'xx.a' in 'order clause'

2. add rewriteField() function to rewrite the column field in where | order by clause.
e.g.:
delete from t where a=1;
after rewrite maybe:
delete from test.t_0001 where test.t_0001.a=1;

[test case]
src/planner/delete_plan_test.go

[patch codecov]
src/planner/common.go  95.8%
src/planner/delete_plan.go 96.2%
hustjieke added a commit to hustjieke/radon that referenced this issue Jan 21, 2021
[summary]
1. add checkField() function to check the column field illegal or not if
the delete statment has field in where | order by clause.
e.g.:
mysql> delete from t where x.a=1;
ERROR 1054 (42S22): Unknown column 'x.a' in 'where clause'
mysql> delete from t where t.a=1 order by xx.a;
ERROR 1054 (42S22): Unknown column 'xx.a' in 'order clause'

2. add rewriteField() function to rewrite the column field in where | order by clause.
e.g.:
delete from t where a=1;
after rewrite maybe:
delete from test.t_0001 where test.t_0001.a=1;

[test case]
src/planner/delete_plan_test.go

[patch codecov]
src/planner/common.go  95.8%
src/planner/delete_plan.go 96.2%
hustjieke added a commit to hustjieke/radon that referenced this issue Jan 25, 2021
[summary]
fix some comments error and code format radondb#713

[test case]
N/A

[patch codecov]
N/A
BohuTANG added a commit that referenced this issue Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P0 High priority type: feature
Projects
None yet
Development

No branches or pull requests

1 participant